Added in Config Postload (#1336)

* Added in an `onload` variable to configs which is called by the plugin loader.

* Used appropriate parameter.

* Fixed tabbing.
This commit is contained in:
Adam 2023-01-19 10:14:45 -05:00 committed by George Sokianos
parent 920d3ef1e3
commit 9b0a348a91
1 changed files with 3 additions and 1 deletions

View File

@ -1010,7 +1010,7 @@ function core.load_plugins()
table.insert(list, plugin.file) table.insert(list, plugin.file)
elseif config.plugins[plugin.name] ~= false then elseif config.plugins[plugin.name] ~= false then
local start = system.get_time() local start = system.get_time()
local ok = core.try(require, "plugins." .. plugin.name) local ok, loaded_plugin = core.try(require, "plugins." .. plugin.name)
if ok then if ok then
core.log_quiet( core.log_quiet(
"Loaded plugin %q from %s in %.1fms", "Loaded plugin %q from %s in %.1fms",
@ -1021,6 +1021,8 @@ function core.load_plugins()
end end
if not ok then if not ok then
no_errors = false no_errors = false
elseif config.plugins[plugin.name].onload then
core.try(config.plugins[plugin.name].onload, loaded_plugin)
end end
end end
end end