1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-17 09:37:02 +00:00

lua: Preload json module (#330)

Signed-off-by: James Hillyerd <james@hillyerd.com>
This commit is contained in:
James Hillyerd
2023-02-10 11:44:36 -08:00
committed by GitHub
parent b38b2e9760
commit 5d18d79539
3 changed files with 8 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ import (
"sync"
"github.com/cjoudrey/gluahttp"
"github.com/inbucket/gopher-json"
lua "github.com/yuin/gopher-lua"
)
@@ -28,6 +29,7 @@ func (lp *statePool) newState() (*lua.LState, error) {
// Load supplemental native modules.
ls.PreloadModule("http", gluahttp.NewHttpModule(&http.Client{}).Loader)
ls.PreloadModule("json", json.Loader)
// Setup channels.
for name, ch := range lp.channels {