Take a tour !
A quick overview of Luart
This is a brief introduction to Luart that shouldn't take more than 10 minutes to go through.
Make sure you have Luart installed before beginning. (In case you have not done so, go to the Installation instructions before beginning)
As part of Luart, there is an interactive console called Quickrt, a REPL which stands for Read, Eval, Print and Loop. This is a Lua interpreter that waits for user input, evaluates the input, prints the result, and repeats the process over and over again. Using this interactive console during such sessions is a great way to learn the framework.
Quickrt can be started using the Windows Start Menu (in the LuaRT submenu) or by typing
quickrt into a console window (cmd.exe or Windows Terminal, for example). You can also double-click on it (Quickrt is in the "\bin" folder inside the Luart installation directory).
Quickrt displays a blue triangle (the prompt) after a greeting message. This prompt indicates the interpreter is waiting for you to enter an expression or a statement.
Hello World !
Everyone knows that to become a programmer, or to learn a new programming language, one has to write a program to greet the world. Let's not break tradition, type "Hello World !" on the command prompt, and press ENTER :
The second line (in gray) is simply the interpreter's way of showing us the result of the previous expression it evaluated. As a result, the interpreter printed the string "Hello World".
In Lua, another more classic way to write "Hello World" is to use the global
To write text to the terminal, standard Lua provides only the
console module in Luart that contains properties and functions which permit additional functionality. You will need to require for it first:
Now we're going to use the
console.writecolor() function to write "Hello World" in color :
The first parameter of this function is the color, as a string, and the second parameter is a string that contains the text to be printed. Pretty easy !