2020-02-25 20:47:42 +01:00
# Modding Library (`modlib`)
2020-02-13 11:11:52 +01:00
Multipurpose Minetest Modding Library
2019-05-01 16:53:01 +02:00
2019-05-03 13:51:17 +02:00
## About
2020-02-13 11:11:52 +01:00
No dependencies. Licensed under the MIT License. Written by Lars Mueller aka LMD or appguru(eu).
2019-05-03 13:51:17 +02:00
2019-05-01 16:53:01 +02:00
## API
2020-02-13 11:11:52 +01:00
2020-06-02 23:07:33 +02:00
Mostly self-documenting code. Mod namespace is `modlib` or `_ml` , containing all variables & functions.
## Configuration
2020-12-20 14:39:01 +01:00
### Legacy
2020-06-28 22:42:24 +02:00
1. Configuration is loaded from `<worldpath>/config/<modname>.<extension>` , the following extensions are supported and loaded (in the given order), with loaded configurations overriding properties of previous ones:
2020-06-02 23:07:33 +02:00
1. [`json` ](https://json.org )
2020-06-28 22:42:24 +02:00
2. [`lua` ](https://lua.org )
3. [`luon` ](https://github.com/appgurueu/luon ), Lua but without the `return`
4. [`conf` ](https://github.com/minetest/minetest/blob/master/doc/lua_api.txt )
2020-12-20 14:39:01 +01:00
2. Settings are loaded from `minetest.conf` and override configuration values
### Locations
0. Default configuration: `<modfolder>/conf.lua`
1. World configuration: `config/<modname>.<format>`
2. Mod configuration: `<modfolder>/conf.<format>`
3. Minetest configuration: `minetest.conf`
### Formats
1. [`lua` ](https://lua.org )
* Lua, with the environment being the configuration object
* `field = value` works
* Return new configuration object to replace
2. [`luon` ](https://github.com/appgurueu/luon )
* Single Lua literal
* Booleans, numbers, strings and tables
3. [`conf` ](https://github.com/minetest/minetest/blob/master/doc/lua_api.txt )
* Minetest-like configuration files
4. [`json` ](https://json.org )
* Not recommended