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?

If you don't have any programming experience, look around in the Internet for tutorials or read Programming in Lua here (note: only for Lua 5.0, but it's still mostly true for Lua 5.1).

Read the Reference manual for Lua 5.1.

You can also learn by practicing. Open .lua files of mods and edit them.

Personal tools