Lua Language Tutorial
Posted: Wed May 02, 2012 7:45 am
Writing and Running Lua Code
You can use the Zeus IDE to write and execute Lua code.
Here is a simple example:
1) Create a c:\temp\test.lua file using the Lua code shown below:
2) Use the Compiler, Compile menu to syntax check the Lua code.
3) To run the code use the Macros, Execute 'test.lua' menu and the following output will be captured inside Zeus:
Checking Lua Code for Errors
As mention earlier the IDE can be used to check the Lua code for syntax errors.
For example consider this piece of code which contains a Lua syntax error:
This code can be syntax checked using the Zeus Compiler, Compile menu which when run reports the following error:
Cheers Jussi
You can use the Zeus IDE to write and execute Lua code.
Here is a simple example:
1) 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) To run the code use the Macros, Execute 'test.lua' menu and the following output will be captured inside Zeus:
Code: Select all
---------------------------------------------------------------------------
Zeus for Windows Programmers Editor - Version 3.97k
Copyright (c) Xidicone P/L 1993-2012. All rights reserved.
---------------------------------------------------------------------------
Hello from Lua 5.2 on 05/02/12 18:06:17
As mention earlier the IDE can be used to check 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
Code: Select all
Lua 5.2.0 Copyright (C) 1994-2011 Lua.org, PUC-Rio
luac52.exe: D:\Temp\test.lua:3: 'then' expected near 'return'