Lua

From Minetest Developer Wiki
Jump to: navigation, search
Language: English  • 日本語

Lua is a free scripting language. The simple C API makes it easy to embed Lua scripts into C/C++ programs (such as Minetest).

How does Minetest use it?

The Minetest engine has a simple Lua API and uses Lua 5.1. The Lua scripts are loaded from mods. The mods can define nodes, tools, and other content via the API.

Minetest benefits from the powerful tables of Lua. They can store more things than the arrays of other programming languages (e.g. functions). This makes it easy to create the definitions of nodes and other content.

Minetest also uses LuaJIT if it is system wide installed. LuaJIT is a just-in-time compiler that is in average 2 times faster than the normal interpreted Lua code. No modification in the mod code is necessary.
If LuaJIT is used, the lua folder is ignored.

Where can I learn it?

Here is a good tutorial/reference: http://lua.org/pil
You can also learn in lua files of mods by editing them.

Personal tools
Namespaces

Variants
Actions
Navigation
API
Toolbox