From ac24f3f4368728c7e451ec7c1d2a77b3221940c0 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Tue, 9 May 2017 15:22:28 +1000 Subject: Use 'delete' instead of setting to undefined --- src/lapi.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/lapi.js b/src/lapi.js index 89297cc..e847cec 100644 --- a/src/lapi.js +++ b/src/lapi.js @@ -281,7 +281,7 @@ const lua_pushcclosure = function(L, fn, n) { L.top -= n; while (n--) { cl.upvalue[n].setfrom(L.stack[L.top + n]) - L.stack[L.top + n] = void 0; + delete L.stack[L.top + n]; } L.stack[L.top] = new TValue(CT.LUA_TCCL, cl); @@ -369,7 +369,7 @@ const lua_setmetatable = function(L, objindex) { } } - L.stack[--L.top] = void 0; + delete L.stack[--L.top]; return true; }; @@ -393,8 +393,8 @@ const lua_seti = function(L, idx, n) { assert(L.top <= L.ci.top, "stack overflow"); lvm.settable(L, t, L.stack[L.top - 1], L.stack[L.top - 2]); /* pop value and key */ - L.stack[--L.top] = void 0; - L.stack[--L.top] = void 0; + delete L.stack[--L.top]; + delete L.stack[--L.top]; }; const lua_rawset = function(L, idx) { @@ -411,7 +411,7 @@ const lua_rawseti = function(L, idx, n) { let o = index2addr(L, idx); assert(o.ttistable(), "table expected"); ltable.luaH_setint(o.value, n, L.stack[L.top - 1]); - L.stack[--L.top] = void 0; + delete L.stack[--L.top]; }; const lua_rawsetp = function(L, idx, p) { @@ -847,7 +847,7 @@ const lua_setuservalue = function(L, idx) { let o = index2addr(L, idx); assert(L, o.ttisfulluserdata(), "full userdata expected"); o.uservalue.setfrom(L.stack[L.top - 1]); - L.stack[--L.top] = void 0; + delete L.stack[--L.top]; }; const lua_callk = function(L, nargs, nresults, ctx, k) { -- cgit v1.2.3-70-g09d2