diff options
Diffstat (limited to 'worker.go')
| -rw-r--r-- | worker.go | 26 |
1 files changed, 1 insertions, 25 deletions
@@ -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") } |
