gopher-lua
gopher-lua copied to clipboard
GetTop() is incorrect after SkipOpenLibs
L := lua.NewState(lua.Options{SkipOpenLibs: true, CallStackSize: 256, RegistrySize: 256 * 20})
lua.OpenBase(L)
lua.OpenString(L)
lua.OpenTable(L)
lua.OpenMath(L)
defer L.Close()
ctx, cancel := context.WithTimeout(context.Background(), time.Duration(timeout)*time.Second)
defer cancel()
L.SetContext(ctx)
if err := L.DoString(`
function a(c,v)
--io.open()
--print(_G)
return c+v
end
local ccc ={}
ccc["1123"] = 123456
print(ccc)
`); err != nil {
return "", err
}
value := L.GetTop()
fmt.Println("GetTop", value)