Error PANIC attempt to call a nil value (global 'unpack'))
dooleydiligent opened this issue · comments
Lane Holcombe commented
I work in typescript
My script is
const code = 'return unpack({"one", "two", "three"})';
const L: any = lauxlib.luaL_newstate();
lualib.luaL_openlibs(L);
const loadStatus = lauxlib.luaL_loadstring(L, fengari.to_luastring(`${code}`));
if (loadStatus !== lua.LUA_OK) {
// fail
}
lua.lua_call(L, 0, lua.LUA_MULTRET);
I expect to see the 'one' value returned but instead I get the subject PANIC.
fengari@0.1.4
Must I explicitly set pack/unpack and others to global?
Anyone can help?
Benoit Giannangeli commented
Fengari implements Lua 5.3: unpack
is table.unpack
.
Lane Holcombe commented
Thanks. resolved