跳转至

入门

欢迎!

Lua is a powerful and fast programming language that is easy to learn and use and to embed into your application.

Lua is designed to be a lightweight embeddable scripting language. It is used for all sorts of applications, from games to web applications and image processing.

See the about page for details and some reasons why you should choose Lua.

See what Lua programs look and feel like in the live demo.

学习

A good place to start learning Lua is the book Programming in Lua, available in paperback and as an e-book. The first edition is freely available online. See also course notes based on this book.

The official definition of the Lua language is given in the reference manual.

See the documentation page and the wiki for more.

获得帮助

Our community is friendly and will most probably help you if you need. Just visit the mailing list, the chat room, and stackoverflow.

If you need help in Portuguese, join the Lua BR mailing list and visit pt.stackoverflow.

See also the FAQ, the community-maintained wiki and LuaFaq, and the much longer uFAQ.

工具

If you need to complement the standard Lua libraries to handle more complex tasks, visit LuaRocks, the main repository of Lua modules. See also Awesome Lua, a curated list of quality Lua packages and resources. The lua-users wiki lists many user-contributed addons for Lua.

支持

You can help to support the Lua project by buying a book published by Lua.org and by making a donation.

You can also help to spread the word about Lua by buying Lua products at Zazzle.

安装

Use the live demo to play with Lua if you don't want to install anything on your computer.

To run Lua programs on your computer, you'll need a standalone Lua interpreter and perhaps some additional Lua libraries. Pre-compiled Lua libraries and executables are available at LuaBinaries. Use your favorite text editor to write your Lua programs. Make sure to save your programs as plain text. If you want an IDE, try ZeroBrane Studio.

If you use Windows, try LuaDist, a multi-platform distribution of the Lua that includes batteries.

If you use Linux or Mac OS X, Lua is either already installed on your system or there is a Lua package for it. Make sure you get the latest release of Lua (currently 5.4.3).

Lua is also quite easy to build from source, as explained below.

从代码源安装

Lua is very easy to build and install. Just download it and follow the instructions in the package.

Here is a simple terminal session that downloads the current release of Lua and builds it in a Linux system:

Bash
curl -R -O http://www.lua.org/ftp/lua-5.4.3.tar.gz
tar zxf lua-5.4.3.tar.gz
cd lua-5.4.3
make all test

If you don't have curl, try wget. If you use Windows and want to build Lua from source, there are detailed instructions in the wiki.

签入

To embed Lua into your C or C++ program, you'll need the Lua headers to compile your program and a Lua library to link with it. If you're getting a ready-made Lua package for your platform, you'll probably need the development package as well. Otherwise, just download Lua and add its source directory to your project.

回到页面顶部