1, download the LUA installation package
Download Address: http://www.lua.org/download.html, the newest LUA is currently 5.2.3. Decompression to get doc, SRC, Makefile, readme a total of 4 files.
2. Compiling the LUA environment
1 below the console CD Lua decompression path.
2 Execute make platform, I am a Mac, so execute make macosx;
3 Generate LUA and Luac two executables in SRC, these two files can be taken out separately, such as we create the bin directory under the LUA decompression path, and put the resulting executable file in.
3, Hello Lua
1) Direct output of the console:
(1) Execute:./lua in the LUA executable directory that was just generated, into the LUA environment.
(2) Input: Print ("Hello lua") Enter, you can play Hello Lua, successful. Control+d Exit current LUA Interactive command
2 Compile output through file:
(1) Implementation: Nano Hello.lua;
(2) Enter: Print ("Hello Lua"), and then execute Control+x;y;control M sequentially. At this point, Hello.lua is saved to the directory of the LUA executable file.
(3) Execute./lua hello.lua to print hello Lua.
(4) can also be compiled and executed:./luac Hello.lua. At this point, the luac.out is generated in the Hello.lua directory, and/lua luac.out is executed. You can also print Hello Lua.