Lua Learning Note (i): Building a development environment

Source: Internet
Author: User

Lua is a small, efficient, interpreted scripting language that can be easily embedded into any language, and many applications and games use LUA as their embedded scripting language for configuration and scalability. This includes World of Warcraft, the gate of Lourdes, Angry Birds, VOCALOID3, sun god Three Kingdoms kill.

Download and compile

Download Connection: http://www.lua.org/download.html, click the download button to download the LUA source code.

Extracted after the source code is not directly used, we also need to manually compile to use.

Compile under Window

Basically we need to install vs to compile.

Compiling Lua.exe

The program is the LUA interpreter.

    1. Create a new VC + + Console application, the project name is LUA;
    2. Remove the pre-compiled header check;
    3. Copy all the files in the extracted SRC folder to the project folder, you need to note that luac.c do not copy, and lua.c to keep;
    4. Click "Show All Files" button in "Explorer", you can see all the source files copied;
    5. Select all the source files, right click "Include in Project", all the source files can be included in the project;
    6. Lua.exe files can be obtained by running the project;
Compiling Luac.exe

The program is the LUA compiler.

The steps are consistent with the above, except that the LUAC.C is preserved and the LUA.C is removed.

Compiling a LUA static or dynamic library

The steps are consistent with the above, except that both LUA.C and LUAC.C are removed, and when the project is created, the corresponding type is selected, whether it is a DLL or a static library.

MacOS under Compile

It's very handy with windows, and you don't need to install anything, just go through the terminal and type "make MacOS" command.

Development tools

工欲善其事 its prerequisite, we need a handy IDE to edit LUA code, the following two I would like to recommend the IDE to everyone.

LDT

: http://www.eclipse.org/koneki/ldt/

The LDT itself has integrated the LUA compiler and interpreter, we can directly extract after the direct use without making any changes, very convenient.

Sublime

Sublime is my personal favorite editor, which natively supports the syntax coloring of LUA scripts, and we have a simple configuration that allows them to run LUA code, but it is important to note that this function is only to run LUA scripts, and the results are only equivalent to Lua [Filename.lua] , unable to enter text control, colleagues can not set breakpoints for debugging, if you need these functions, please use the above LDT.

To configure Windows as an example:

    • First, we find the path of the lua.exe we started to generate.
    • Click "Tools", "Build System", "New build System";
    • Fill in the following script:
{    "cmd": ["E:\\study\\c++\\lua\\debug\\lua.exe", "$file"],     "File_regex": "^ (?: Lua:)? [ \ t] (...):( [0-9]*):? ([0-9]*) ",     " selector ":" Source.lua "}
    • Save as Lua;
    • Our LUA script can then be run directly by clicking on "Tools", "Build".

Lua Learning Note (i): Building a development environment

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.