2023-05-17 23:18:24 +02:00
|
|
|
--[[ md
|
|
|
|
@name lua/addon
|
|
|
|
|
2023-06-10 04:06:42 +02:00
|
|
|
## Addon
|
|
|
|
|
|
|
|
Addons allow you to modify the behavior of smr without modifying the smr
|
|
|
|
source code. This is intended to make updates easier, and to modularize parts
|
|
|
|
of smr that are not minimally required.
|
|
|
|
|
2023-03-12 04:31:08 +01:00
|
|
|
Addon loader - Addons are either:
|
|
|
|
* A folder with at least two files:
|
2023-05-17 23:18:24 +02:00
|
|
|
- meta.lua - contains addon information
|
2023-03-12 04:31:08 +01:00
|
|
|
- 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
|
2023-06-10 04:06:42 +02:00
|
|
|
|
|
|
|
And there are at least 2 rows with filenames `meta.lua` and `init.lua`
|
|
|
|
as described above. Addons should be placed in {{config/addons_folder},
|
|
|
|
defined in `config.lua`
|
2023-03-12 04:31:08 +01:00
|
|
|
|
|
|
|
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.
|
2023-05-17 23:18:24 +02:00
|
|
|
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.
|
2023-03-12 04:31:08 +01:00
|
|
|
]]
|
|
|
|
|
2023-04-06 23:27:28 +02:00
|
|
|
local oldconfigure = configure
|
|
|
|
function configure(...)
|
|
|
|
return oldconfigure(...)
|
|
|
|
end
|