diff options
author | terminaldweller <devi@terminaldweller.com> | 2024-06-09 14:38:00 +0000 |
---|---|---|
committer | terminaldweller <devi@terminaldweller.com> | 2024-06-09 14:38:00 +0000 |
commit | 309de82960b717f61dd90b908c2c28955955f504 (patch) | |
tree | 4a9a6997e25383e555200084e3835358edeb3701 /plugins.go | |
parent | updated the readme, remove girc.Client as an arg to the lua extension functio... (diff) | |
download | milla-309de82960b717f61dd90b908c2c28955955f504.tar.gz milla-309de82960b717f61dd90b908c2c28955955f504.zip |
added a load and unload command for plugins
Diffstat (limited to 'plugins.go')
-rw-r--r-- | plugins.go | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -1,6 +1,7 @@ package main import ( + "context" "log" "net/http" "reflect" @@ -285,6 +286,12 @@ func RunScript(scriptPath string, client *girc.Client, appConfig *TomlConfig) { luaState := lua.NewState() defer luaState.Close() + ctx, cancel := context.WithCancel(context.Background()) + + luaState.SetContext(ctx) + + appConfig.insertLState(scriptPath, luaState, cancel) + luaState.PreloadModule("milla", millaModuleLoaderClosure(luaState, client, appConfig)) gluasocket.Preload(luaState) gluaxmlpath.Preload(luaState) |