Files
MontaukOS/montaukos.org/docs/usersmanual/tutorial-programming.html
T

139 lines
4.3 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="MontaukOS User's Manual">
<title>Lua Hello World - MontaukOS Tutorials</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Open Sans', Arial, sans-serif;
max-width: 960px;
margin: 0 auto;
padding: 1em;
line-height: 1.5;
display: flex;
gap: 2em;
}
p { margin: 0 0 0.5em; }
h2 { margin: 0.5em 0; }
.sidebar {
width: 160px;
flex-shrink: 0;
}
.sidebar ul {
list-style: none;
padding: 0;
}
.sidebar li {
margin: 0.5em 0;
}
.sidebar a {
color: #0066CC;
text-decoration: none;
font-weight: 600;
}
.sidebar a:hover {
color: #004499;
text-decoration: underline;
}
.sidebar hr {
border: none;
border-top: 1px solid #999;
margin: 0.75em 0;
}
.main {
flex: 1;
min-width: 0;
}
a { color: #0000EE; }
a:visited { color: #0066CC; }
hr { border-style: solid; border-width: 1px 0 0 0; border-color: #999; }
.box {
border: 1px solid #999;
padding: 0.5em;
margin: 0.5em 0;
}
.doc-list {
list-style: none;
padding: 0;
}
.doc-list li {
margin: 0.75em 0;
}
.doc-list a {
font-weight: 600;
}
.doc-list p {
margin: 0.25em 0 0 1.5em;
color: #555;
font-size: 0.9em;
}
</style>
</head>
<body>
<div class="sidebar">
<ul>
<li><a href="../index.html">Home</a></li>
<li><a href="../index.html">Documentation</a></li>
</ul>
<hr>
<ul>
<li><a href="index.html" class="current">User's Manual</a></li>
</ul>
</div>
<div class="main">
<div class="center">
<h2>Writing and running a "Hello, World" program in Lua</h2>
</div>
<hr>
<p>This tutorial explains how to create and run a simple program in the Lua programming language on MontaukOS.</p>
<hr><ol>
<li>Open the Text Editor by navigating to the 'Applications' section in the app menu.</li>
<blockquote><strong>Did you know?</strong> The MontaukOS Text Editor provides syntax highlighting for C and Lua files.</blockquote>
<li>Type:
<blockquote><code>print("Hello, World!")</code></blockquote>
into the Text Editor window. This code outputs the string "Hello, World!" to the Terminal.</li><br>
<blockquote>
<img src="images/texteditor-lua.png" alt="">
</blockquote>
<li>Click the Save (floppy disk) button on the top panel. Choose a directory to save your code in - for example, your Home folder - give the program a name ending in <i>.lua</i>, and click 'Save'.</li>
<br><li>Open the Terminal app by navigating to the 'Applications' section in the app menu. You should see something like this appear on your screen:
<blockquote><pre>
MontaukOS
Copyright (c) 2025-2026 Montauk Operating System Project
Logged in as admin
Type 'help' for available commands.
0:/users/admin>
</pre>
</blockquote>
</li>
<li>If you saved your program somewhere other than your Home directory, switch to the directory in which you saved your program using the <i>cd</i> command. For example, <code>cd Documents</code>.</li>
<br><li>Type '<code>lua </code>' followed by your program's name, and then press enter. For example, '<code>lua hello.lua</code>'.</li>
<br><li>You should see "Hello, World!" displayed in the Terminal window. Congratulations!</li>
<br>
<img src="images/terminal-lua.png" alt="">
</ol>
<hr>
<h3>Beware!</h3>
<p>The Lua implementation on MontaukOS currently has known issues. For example, floating point calculations do not work.</p>
<hr>
<div class="center">
<a href="../index.html">Back to Documentation Index</a>
</div>
</div>
</body>
</html>