From 022f7f974b6cb13b9a432986bce072f719fa60d6 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Thu, 11 May 2017 09:40:31 +0200 Subject: uservalue should be a TValue --- src/lapi.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/lapi.js b/src/lapi.js index a5cfb8d..9fc1cc7 100644 --- a/src/lapi.js +++ b/src/lapi.js @@ -496,7 +496,7 @@ const luaS_newudata = function(L, size) { return { id: L.l_G.id_counter++, metatable: null, - uservalue: null, + uservalue: new lobject.TValue(CT.LUA_TNIL, null), len: size, data: Object.create(null) // ignores size argument }; @@ -595,7 +595,7 @@ const lua_getmetatable = function(L, objindex) { const lua_getuservalue = function(L, idx) { let o = index2addr(L, idx); assert(L, o.ttisfulluserdata(), "full userdata expected"); - let uv = o.uservalue; + let uv = o.value.uservalue; L.stack[L.top++] = new TValue(uv.type, uv.value); assert(L.top <= L.ci.top, "stack overflow"); return L.stack[L.top - 1].ttnov(); @@ -895,7 +895,7 @@ const lua_setuservalue = function(L, idx) { assert(1 < L.top - L.ci.funcOff, "not enough elements in the stack"); let o = index2addr(L, idx); assert(L, o.ttisfulluserdata(), "full userdata expected"); - o.uservalue.setfrom(L.stack[L.top - 1]); + o.value.uservalue.setfrom(L.stack[L.top - 1]); delete L.stack[--L.top]; }; -- cgit v1.2.3-70-g09d2