lua-stable
lua-stable copied to clipboard
Test case fails
The test case fails.
local sraw = require "stable.raw" sraw.init() -- init lightuserdata metatable local t = sraw.create() t.hello = { world = true } -- fails at here
//line 100, lua-stable.c static void _set_value(lua_State *L, struct table * t, const char *key, size_t sz, int idx) { The type will be LUA_TTABLE, it is not supported.
The following code works, local t2 = sraw.create() sraw.set(t2, "world", true) sraw.set(t, "hello", t2)
The normal lua table can not be set into a stable. We may need a deep copy con-structure in _set_value() to set table into stable. The normal lua table can not be shared, it belongs to it's state.