Lua Learning "1": Setting up the environment under the Mac platform and the output and compilation of Hello Lua

Source: Internet
Author: User
Tags lua

1. Download LUA installation package
: Http://www.lua.org/download.html, currently the latest LUA is 5.2.3. Extracted by the doc, SRC, Makefile, readme a total of 4 files.
2. Compiling the LUA environment

1) Console CD LUA decompression path. 2) Execute make platform, I am mac, so do make macosx;3) generate LUA and luac two executable in SRC

File, these two files can be taken out separately, for example, we create the bin directory under the LUA decompression path, and put the generated executable file in.

3. Hello Lua

1) Console Direct output: (1) Execute under the LUA executable directory just generated:./lua, into the LUA environment. (2) Input: Print ("Hello Lua") Enter,

You can play Hello Lua and succeed. Control+d exiting the current LUA interactive command

2) Compile output by file: (1) Execute: Nano Hello.lua; (2) Enter: print ("Hello lua"), then execute Control+x;y;control M in turn.

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 after execution:./luac Hello.lua. At this point in the Hello.lua directory generated Luac.out, execute./lua luac.out. You can also print Hello Lua.


Not finished, to be continued ~

Lua Learning "1": Setting up the environment under the Mac platform and the output and compilation of Hello Lua

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.