Getting lua script

Download some projects on the Internet, inside there is often .lua .sh .in .cmake .bat file, etc.

Today special about the investigation of the role of the relevant documents

.sh usually linux, script files (text file) under unix systems, used to call the default shell, perform some operating system commands, understood that under similar dos command windows.

.in is a unified file management. check out is to download a file to a local database, once the file has been out check, others allow only browse the files, but can not modify this file, the file is only after check in, other people can check out this file work to modify this file.

.lua This is our focus:

What lua files are?

  One kind of small scripting language, which is designed for embedded applications, providing flexible expansion and customization features for the application. Lua written by the standard C made, almost all can be compiled on all operating systems and platforms, run. Lua does not provide a strong library, which is determined by its location. So Lua is not suitable as a stand-alone application development language. Lua has a JIT project simultaneously, providing real-time compilation on a specific platform.

  Lua scripts can easily be called C / C ++ code can turn call the function C / C ++, which makes Lua in your application can be widely used. Not only as an extension script can be used as a normal configuration file, instead of XML, ini file format, and easier to understand and maintain. Written by Lua from standard C code is simple and beautiful, almost all can be compiled on all operating systems and platforms, run. A complete Lua interpreter but 200k, all in the current script engine, Lua is the fastest speed. All this determines the Lua script is embedded as the best choice.

  Lua interactive mode operation can also be saved with the Notepad to edit code format .lua running through lua compiler. It can also third-party tools, lua package will run independently.

Local environmental structures

In the run set up a local development environment Lua programming language, you need to install the following three software on your computer: (1) text editor. (2) Lua interpreter. (3) Lua compiler.

text editor

Text editor to edit your program code. There are several commonly used as a text editor software: Windows notepad, Brief, Epsilon, EMACS, vim / vi.

Lua interpreter

Lua interpreter is a Lua command allows you to enter and execute immediately the applet. It executing a Lua file process, once an error is encountered immediately stop the execution, unlike the compiler will perform a full file.

Lua compiler

If Lua will be extended to other languages or applications, we need a software development kit and application interfaces compatible Lua compiler.
In the Windows system is installed Lua
in the Windows system environment can be installed in a place called SciTE Lua development IDE (Integrated Development Environment). It can be downloaded here: http://code.google.com/p/luaforwindows/ .

 

Creating Hello Lua

  • 1) direct the console output:
    (1) executed in just generated lua executable directory: ./ lua, lua into the environment.
    (2) Input: print ( "Hello Lua") Enter, you can play Hello Lua, success. control + D to exit the current interactive command lua
  • 2) by the compiler output file:
    (1) perform: Nano hello.lua; // Create hello.lua file
    (2) Input: print ( "Hello Lua") , followed by performing control + X; Y; control M. At this point, hello.lua saved to the directory lua executable file.
    (3) the implementation of ./lua hello.lua to print Hello Lua.
    (4) can also be performed after compilation: ./ luac hello.lua. In this case hello.lua directory generated luac.out performed ./lua luac.out. You can also print Hello Lua.
 
 

Guess you like

Origin www.cnblogs.com/ice-arrow/p/11353772.html