2021-09-10 21:06:16 +02:00
# ![Logo](logo.svg) Modding Library (`modlib`)
2020-02-13 11:11:52 +01:00
Multipurpose Minetest Modding Library
2019-05-01 16:53:01 +02:00
2022-10-29 17:31:23 +02:00
## At a glance
2020-02-13 11:11:52 +01:00
2022-10-29 17:31:23 +02:00
No dependencies. Licensed under the MIT License. Written by Lars Mueller aka LMD or appguru(eu). Requires Lua 5.1 / LuaJIT.
### Acknowledgement
* [luk3yx ](https://github.com/luk3yx ): Various suggestions, bug reports and fixes
* [grorp ](https://github.com/grorp ) (Gregor Parzefall): [Bug reports & proposed fixes for node box code ](https://github.com/appgurueu/modlib/pull/8 )
* [NobWow ](https://github.com/NobWow/ ): [Another bugfix ](https://github.com/appgurueu/modlib/pull/7 )
2019-05-03 13:51:17 +02:00
2022-09-09 14:49:15 +02:00
### Principles
* Game-agnostic: Modlib aims to provide nothing game-specific;
* Minimal invasiveness: Modlib should not disrupt other mods;
even at the expense of syntactic sugar, changes to the global
environment - apart from the addition of the modlib scope - are forbidden
* Architecture: Modlib is organized hierarchically
2022-09-09 20:03:51 +02:00
* Performance: Modlib tries to not compromise performance for convenience; modlib loads lazily
2022-09-09 14:49:15 +02:00
2022-06-27 21:19:24 +02:00
## Tests
The tests are located in a different repo, [`modlib_test` ](https://github.com/appgurueu/modlib_test ), as they are quite heavy due to testing the PNG reader using PngSuite. Reading the tests for examples of API usage is recommended.
2022-09-09 14:42:29 +02:00
2019-05-01 16:53:01 +02:00
## API
2020-02-13 11:11:52 +01:00
2022-09-09 20:03:51 +02:00
(Incomplete) documentation resides in the `doc` folder; you'll have to dive into the code for everything else.
2021-08-16 18:11:55 +02:00
2022-09-09 20:03:51 +02:00
The mod namespace is `modlib` , containing all modules which in turn contain variables & functions.
2021-04-21 21:11:00 +02:00
2022-09-09 20:03:51 +02:00
Modules are lazily loaded by indexing the `modlib` table. Do `_ = modlib.<module>` to avoid file load spikes at run time.
2021-04-21 21:11:00 +02:00
2022-09-09 20:03:51 +02:00
Localizing modules (`local < module > = modlib.< module > `) is recommended.