From a6412f9fc48f410ba4e3b39938d8d3f6a5597066 Mon Sep 17 00:00:00 2001 From: unwox Date: Fri, 23 Aug 2024 21:57:33 +0600 Subject: small fixes --- worker.go | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) (limited to 'worker.go') diff --git a/worker.go b/worker.go index 77aae33..b4cae12 100644 --- a/worker.go +++ b/worker.go @@ -209,30 +209,6 @@ func (w *Worker) HasSameLua(l *Lua) bool { // initLunaModule registers the module in the Lua context. func (w *Worker) initLunaModule(module map[string]any) { - var pushTable func(t map[string]any) - pushTable = func (t map[string]any) { - w.lua.CreateTable(len(t)) - for k, v := range t { - switch v.(type) { - case string: - v, _ := v.(string) - w.lua.PushString(v) - case func (l *Lua) int: - v, _ := v.(func (l *Lua) int) - w.lua.PushGoFunction(v) - case int: - v, _ := v.(int) - w.lua.PushNumber(v) - case map[string]any: - v, _ := v.(map[string]any) - pushTable(v) - default: - // FIXME: more details. - log.Fatal("unsupported module value type") - } - w.lua.SetTableItem(k) - } - } - pushTable(module) + w.lua.PushObject(module) w.lua.SetGlobal("luna") } -- cgit v1.2.3