Writing and running a "Hello, World" program in Lua


This tutorial explains how to create and run a simple program in the Lua programming language on MontaukOS.


  1. Open the Text Editor by navigating to the 'Applications' section in the app menu.
  2. Did you know? The MontaukOS Text Editor provides syntax highlighting for C and Lua files.
  3. Type:
    print("Hello, World!")
    into the Text Editor window. This code outputs the string "Hello, World!" to the Terminal.

  4. 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 .lua, and click 'Save'.

  5. Open the Terminal app by navigating to the 'Applications' section in the app menu. You should see something like this appear on your screen:
        MontaukOS
        Copyright (c) 2025-2026 Montauk Operating System Project
    
        Logged in as admin
    
        Type 'help' for available commands.
    
    0:/users/admin>
            
  6. If you saved your program somewhere other than your Home directory, switch to the directory in which you saved your program using the cd command. For example, cd Documents.

  7. Type 'lua ' followed by your program's name, and then press enter. For example, 'lua hello.lua'.

  8. You should see "Hello, World!" displayed in the Terminal window. Congratulations!


Beware!

The Lua implementation on MontaukOS currently has known issues. For example, floating point calculations do not work.


Back to Documentation Index