aboutsummaryrefslogtreecommitdiffstats
path: root/plugin_go.go
diff options
context:
space:
mode:
authorLibravatarLibravatar Simon Ser <[email protected]> 2020-01-20 21:37:28 +0100
committerLibravatarLibravatar Simon Ser <[email protected]> 2020-01-20 21:37:28 +0100
commit01983eb7b5fc553e6ca7ed713ff1c07b0234059b (patch)
treef99646209f5c342ed0731ed35a25ec5f269c5f78 /plugin_go.go
parentd19c17c6d58bcdecbb03125bd4f57b703d726ce5 (diff)
downloadalps-01983eb7b5fc553e6ca7ed713ff1c07b0234059b.tar.gz
alps-01983eb7b5fc553e6ca7ed713ff1c07b0234059b.tar.bz2
alps-01983eb7b5fc553e6ca7ed713ff1c07b0234059b.zip
Introduce PluginLoaderFunc
This allows registered plugins to execute code when loaded. This will also allow the Lua support code to be a plugin. Closes: https://todo.sr.ht/~sircmpwn/koushin/54
Diffstat (limited to 'plugin_go.go')
-rw-r--r--plugin_go.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/plugin_go.go b/plugin_go.go
index 34abeeb..9a6bb64 100644
--- a/plugin_go.go
+++ b/plugin_go.go
@@ -132,3 +132,10 @@ func (p *GoPlugin) Inject(name string, f InjectFunc) {
func (p *GoPlugin) Plugin() Plugin {
return &goPlugin{p}
}
+
+// Loader returns a loader function for this plugin.
+func (p *GoPlugin) Loader() PluginLoaderFunc {
+ return func(*Server) ([]Plugin, error) {
+ return []Plugin{p.Plugin()}, nil
+ }
+}