The development Environment Configuration tutorial for Lua in various operational systems _lua

Source: Internet
Author: User
Tags lua

LUA Development environment settings

If you are willing to set up your LUA programming locale, you need to use the following two software on your computer, (a) text editor, (b) Lua interpretation, and (c) the LUA compiler.
Text Editor

This will be used to enter the writing program. Some editors include Windows Notepad, OS edit commands, Brief,epsilon,emacs and Vim or VI.

The text editor name and version can be on different operating systems. For example, Notepad is available on Windows, Vim, or VI, which can be used on Windows as well as Linux or UNIX.

The editor creates a file called the source file and the source code that contains the program. The LUA program source file is typically named ". Lua".

Before you start programming, make sure that you have a text editor in place, that you have enough experience to write a computer program that is saved in a file, compiled, and ultimately executed.
LUA Interpreter

This is just a small program, you can type the LUA command to get them to execute immediately. It stops executing when an error is encountered, unlike performing a full compilation of a LUA file.
Lua compilers

When we extend LUA to other languages/applications, we need a software development kit and a compiler that is compatible with the LUA application programming interface.
Installing on Windows

Here is a standalone IDE named "SciTE" that you can download from the http://code.google.com/p/luaforwindows/download area under Windows environment.

Run the download executable file to install the LUA IDE.

Once you have the IDE, you can create and use it to build LUA code.

If you are interested in installing LUA in command line mode, you will need to install MinGW or Cygwin, and then compile and install Lua in Windows.
Installing on Linux

Download and build Lua, using the following command

$ wget http://www.lua.org/ftp/lua-5.2.3.tar.gz
$ tar zxf lua-5.2.3.tar.gz
$ cd lua-5.2.3
$ make Linux test

In order to be installed on other platforms, such as aix,ansi,bsd,linux generic, the Mingw,posix,solaris uses the corresponding platform name to replace the Linux test.

We have a LUA program Helloworld.lua as follows

Copy Code code as follows:
Print ("Hello world!")

Now we can build and run a LUA file that represents the Helloworld.lua switch to the folder include file to use: cd command to enter, and then use the following command.

$ LUA HelloWorld

We can see the output below.

Copy Code code as follows:
Hello World

Installing on Mac OS X

To build/test Lua on Mac OS X, use the following command

$ curl-r-o http://www.lua.org/ftp/lua-5.2.3.tar.gz
$ tar zxf lua-5.2.3.tar.gz
$ cd lua-5.2.3
$ make MacOSX t Est

In some cases, you may not have Xcode and command-line tools installed. In this case, you cannot use the make command. Install Xcode from the Mac App Store. Then go to the Xcode preferences, and then switch to download and install the component named Command line tool. Once this process is complete, the make command is provided to the use.

This is not mandatory and the "Make MacOSX test" declaration was executed. Even if you do not execute this command, you can still use Lua on Mac OS X

We have a LUA program Helloworld.lua as follows

Copy Code code as follows:
Print ("Hello world!")

Now we can build and run a LUA file that represents Helloworld.lua switch to the command CD used in the folder contains file, and then use the following command.

Copy Code code as follows:
$ LUA HelloWorld

We can see the output below.

Copy Code code as follows:
Hello World

Lua IDE

As mentioned earlier, for the Windows SciTE LUA IDE is the default IDE provided by the LUA creator team. The alternate IDE provides the Zerobrane from the IDE, which can span multiple platforms, including WINDOWS,MAC and Linux operating systems.

There are also eclipse plug-ins that can be used to develop LUA. Using the IDE makes it easier to develop, such as code completion, and is highly recommended. The IDE also provides interactive mode programming similar to the command-line version in 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.