gopher-lua icon indicating copy to clipboard operation
gopher-lua copied to clipboard

GetTop() is incorrect after SkipOpenLibs

Open 592530326 opened this issue 3 years ago • 0 comments

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)

592530326 avatar Nov 21 '22 00:11 592530326