Minetest Lua Modding API Reference¶
- 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 Minetest 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 Minetest.
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¶
Minetest 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.