diff options
| author | unwox <me@unwox.com> | 2024-08-23 21:57:33 +0600 |
|---|---|---|
| committer | unwox <me@unwox.com> | 2024-08-23 21:59:49 +0600 |
| commit | a6412f9fc48f410ba4e3b39938d8d3f6a5597066 (patch) | |
| tree | b72e7b27910ed0794d79f12acba22ef5cd0af2af /worker.go | |
| parent | 09509f7d8932829d6392f1787b1de1df4ebd8a7e (diff) | |
small fixes
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") } |
