Lua Language Tutorial

Find Tips and tricks on how to better use the Zeus IDE. Feel free to post your own tips but please do not post bug reports, feature requests or questions here.
Post Reply
jussij
Site Admin
Posts: 2655
Joined: Fri Aug 13, 2004 5:10 pm

Lua Language Tutorial

Post by jussij »

Writing and Running Lua Code

Zeus Lite comes with a version of Lua making it easy to write Lua code.

Zeus Lite can be downloaded from here: https://www.zeusedit.com/lite/index.html

Here is a simple Lua example:

1) Start Zeus Lite

2) Create a c:\temp\test.lua file using the Lua code shown below:

Code: Select all

printf = function(s,...)
           return io.write(s:format(...))
         end

printf("Hello from %s on %s\n", _VERSION, os.date())
3) Use the Compiler, Compile menu to syntax check the Lua code.

If the code contains any errors the compiler output window will be displayed showing the errors found in the code.

If the code is correct, a successful compilation message is displayed in the status bar.

4) To run the code use the Macros, Execute 'test.lua' menu and the following output will be captured inside Zeus:

Code: Select all

---------------------------------------------------------------------------
      Zeus Lite - Version 3.98c
      Copyright (c) Xidicone P/L 1993-2025.  All rights reserved.
---------------------------------------------------------------------------

Hello from Lua 5.4 on Thu Feb 12 16:43:04 2026
Lua Documentation
With any Lua file open, use the Macros, Lua Reference Manual menu to bring up the Lua documentation.

Checking Lua Code for Errors

As mentioned earlier the compilation step checks the Lua code for syntax errors.

For example, consider this piece of code which contains a Lua syntax error:

Code: Select all

function Test(value)
    if (value == 0)
        return
    end
end
This code can be syntax checked using the Zeus Compiler, Compile menu this will result in the following errors:

Code: Select all

luac54.exe: C:\temp\test.lua:3: 'then' expected near 'return'
Lua 5.4.6  Copyright (C) 1994-2023 Lua.org, PUC-Rio
Cheers Jussi
Post Reply