summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-05-11 09:40:31 +0200
committerBenoit Giannangeli <giann008@gmail.com>2017-05-11 09:40:31 +0200
commit022f7f974b6cb13b9a432986bce072f719fa60d6 (patch)
tree7f2b87530992793d0a52c3ddc4530f2953c2716d
parent27de87bca51c4353a2a726afc20a38b36442e31e (diff)
downloadfengari-022f7f974b6cb13b9a432986bce072f719fa60d6.tar.gz
fengari-022f7f974b6cb13b9a432986bce072f719fa60d6.tar.bz2
fengari-022f7f974b6cb13b9a432986bce072f719fa60d6.zip
uservalue should be a TValue
-rw-r--r--src/lapi.js6
1 files changed, 3 insertions, 3 deletions
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];
};