Lua is a powerful scripting language and a valid alternative to other interpreted languages such as ooREXX and Javascript based Windows Scripting Host (WSH). To learn more about Lua visit:
You can install Lua from source, provided you have a C compiler, alternatively you can download the binaries. There are two Lua distributions available for Windows, LuaDist and LuaRocks. I chose to install the LuaDist binaries which comes with batteries i.e. all the useful Lua function libraries.
Luadist can be downloaded from: http://luadist.org/. The download provided is a 32bit windows version so you need to extract the download files first into a folder of your choice and then move this folder or it's child folder (i.e. if zip contains a root folder of its own) to the "Program Files (x86)" system folder. I renamed my folder removing extraneous information i.e. provided was: Binaries-LuaDist-batteries-0.9.8-Windows-x86 which I renamed to LuaDist-batteries-0.9.8
We want to execute line commands of the form "lua filename", lua being the windows program name for the lua interpreter, filename the file containing the lua code to be interpreted. To do this we need to add the Lua binaries to the Windows system path.
Caution: You should have experience in modifying the Windows environment before attempting the following changes.
In windows 10 you need to:
To test for successful install, open a command prompt and enter the command luadist list, this should provide a list of all the installed lua components.
First create a folder where you will keep your scripts e.g. X:\Lua. Open your favourite editor e.g. Notepad++, if you have nothing else open Windows Notepad. Enter the following Lua statement:
print ("Hello World");
Now click on "Save As" and save the file in your new Lua folder as test.lua.
Note: Windows Notepad users will have to change the "Save as type" from "Text Documents (*.txt)" to "All Files (*.*)" otherwise Windows will add a .txt suffix on top off the .lua suffix you specified. Too late? Just change the file name from test.lua.txt to test.lua using windows explorer.
Now open a command prompt and move to your Lua folder e.g. cd \Lua ( or X: then cd \Lua for multiple disks). Now enter the command:
lua test.lua
If everything is working well you should now see your text "Hello World" (without the quotes). Congratulations you have successfully run your first Lua script. Refer to the lua.org site for more information about programming with Lua. Have fun!
Questions or comments, please e-mail us at info@snys.nl