smr/src/lua/addon.lua

24 lines
982 B
Lua
Raw Normal View History

2023-03-12 04:31:08 +01:00
--[[
Addon loader - Addons are either:
* A folder with at least two files:
- meta.lua - contains load order information
- init.lua - entrypoint that gets run to load the addon
* A zip file with the same
* A sqlite3 database with a table "files" that has at least the columns
* name :: TEXT - The filename
* data :: BINARY - The file data
And there are at least 2 rows with filenames `meta.lua` and `init.lua`
as described above. Addons should be placed in $SMR_ADDONS, defined in config.lua
The `meta.lua` file is run at worker init time (i.e. it will be run once for
each worker), and should return a table with at least the following information
{
name :: string - A name for the addon (all addons must have unique names)
desc :: string - A description for the addon.
entry :: table[number -> string] - Describes the load order for this
addon. Each addon's meta.lua is run, and sorted to get a load
order for entrypoints (the strings are the names files)
]]