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

Test case fails

Open zhk opened this issue 7 years ago • 1 comments

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.

zhk avatar Dec 25 '18 10:12 zhk

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.

zhk avatar Dec 26 '18 02:12 zhk