diff options
Diffstat (limited to 'tests/ltablib.js')
-rw-r--r-- | tests/ltablib.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/ltablib.js b/tests/ltablib.js index e209db3..43e742b 100644 --- a/tests/ltablib.js +++ b/tests/ltablib.js @@ -14,7 +14,7 @@ const inttable2array = function(t) { let a = []; t.strong.forEach(function (v, k) { - if (typeof k === 'number') + if (v.key.ttisnumber()) a[k - 1] = v.value; }); @@ -73,7 +73,7 @@ test('table.pack', function (t) { t.deepEqual( [...lua.lua_topointer(L, -1).strong.entries()] - .filter(e => typeof e[0] === 'number') // Filter out the 'n' field + .filter(e => e[1].key.ttisnumber()) // Filter out the 'n' field .map(e => e[1].value.value).reverse(), [1, 2, 3], "Correct element(s) on the stack" @@ -148,7 +148,7 @@ test('table.insert', function (t) { t.deepEqual( [...lua.lua_topointer(L, -1).strong.entries()] - .filter(e => typeof e[0] === 'number') + .filter(e => e[1].key.ttisnumber()) .map(e => e[1].value.value).sort(), [1, 2, 3, 4, 5], "Correct element(s) on the stack" @@ -182,7 +182,7 @@ test('table.remove', function (t) { t.deepEqual( [...lua.lua_topointer(L, -1).strong.entries()] - .filter(e => typeof e[0] === 'number') + .filter(e => e[1].key.ttisnumber()) .map(e => e[1].value.value).sort(), [1, 2, 3, 4], "Correct element(s) on the stack" @@ -215,7 +215,7 @@ test('table.move', function (t) { t.deepEqual( [...lua.lua_topointer(L, -1).strong.entries()] - .filter(e => typeof e[0] === 'number') + .filter(e => e[1].key.ttisnumber()) .map(e => e[1].value.value).sort(), [1, 2, 3, 4, 5, 6], "Correct element(s) on the stack" |