summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lapi.js6
-rw-r--r--src/ltable.js2
2 files changed, 4 insertions, 4 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];
};
diff --git a/src/ltable.js b/src/ltable.js
index 52b5aee..0619efe 100644
--- a/src/ltable.js
+++ b/src/ltable.js
@@ -158,7 +158,7 @@ const luaH_next = function(L, table, keyI) {
if (!table.strong.has(hash))
/* item not in table */
- return ldebug.luaG_runerror(L, "invalid key to 'next'");
+ return ldebug.luaG_runerror(L, defs.to_luastring("invalid key to 'next'"))
let indexes = table.strong.keys();
while (1) {