smr/src/lua/addon.lua

36 lines
1.3 KiB
Lua

--[[ md
@name lua/addon
Addon loader - Addons are either:
* A folder with at least two files:
- meta.lua - contains addon 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.
order :: number - When should we run init.lua relative to other addons?
Each addon's meta.lua is run (in any order), addons are sorted
according to their order, and finally each addon's init.lua is
called according to this order.
}
meta.lua may include additional information that can be read and used by other
addons. meta.lua is run in a restricted environment with almost no functions
available.
]]
local oldconfigure = configure
function configure(...)
return oldconfigure(...)
end