Luanti Lua Modding API Reference¶
WARNING: if you're looking for the minetest
namespace (e.g. minetest.something
),
it's now called core
due to the renaming of Luanti (formerly Minetest).
minetest
will keep existing as an alias, so that old code won't break.
- More information at http://www.minetest.net/
- Developer Wiki: http://dev.minetest.net/
- (Unofficial) Minetest Modding Book by rubenwardy: https://rubenwardy.com/minetest_modding_book/
- Modding tools: https://github.com/minetest/modtools
Introduction¶
Content and functionality can be added to Luanti using Lua scripting in run-time loaded mods.
A mod is a self-contained bunch of scripts, textures and other related things, which is loaded by and interfaces with Luanti.
Mods are contained and ran solely on the server side. Definitions and media files are automatically transferred to the client.
If you see a deficiency in the API, feel free to attempt to add the functionality in the engine and API, and to document it here.
Programming in Lua¶
If you have any difficulty in understanding this, please read Programming in Lua.
Startup¶
Mods are loaded during server startup from the mod load paths by running
the init.lua
scripts in a shared environment.
Paths¶
Luanti keeps and looks for files mostly in two paths. path_share
or path_user
.
path_share
contains possibly read-only content for the engine (incl. games and mods).
path_user
contains mods or games installed by the user but also the users
worlds or settings.
With a local build (RUN_IN_PLACE=1
) path_share
and path_user
both point to
the build directory. For system-wide builds on Linux the share path is usually at
/usr/share/minetest
while the user path resides in .minetest
in the home directory.
Paths on other operating systems will differ.