summaryrefslogtreecommitdiff
path: root/src/ltable.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/ltable.js')
-rw-r--r--src/ltable.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/ltable.js b/src/ltable.js
index 7972f08..432a91d 100644
--- a/src/ltable.js
+++ b/src/ltable.js
@@ -4,7 +4,6 @@
const defs = require('./defs.js');
const lobject = require('./lobject.js');
const CT = defs.constant_types;
-const TValue = lobject.TValue;
const ordered_intindexes = function(table) {
@@ -24,6 +23,11 @@ const ordered_indexes = function(table) {
});
};
+const luaH_new = function(L) {
+ let t = new Map();
+ return t;
+};
+
/*
** Try to find a boundary in table 't'. A 'boundary' is an integer index
** such that t[i] is non-nil and t[i+1] is nil (and 0 if t[1] is nil).
@@ -62,9 +66,9 @@ const luaH_next = function(L, table, keyI) {
let tnidx = typeof nidx;
if (tnidx === 'number' && nidx % 1 === 0)
- L.stack[keyI] = new TValue(CT.LUA_TNUMINT, indexes[i + 1]);
+ L.stack[keyI] = new lobject.TValue(CT.LUA_TNUMINT, indexes[i + 1]);
else if (tnidx === 'string')
- L.stack[keyI] = new TValue(CT.LUA_TLNGSTR, indexes[i + 1].split('|').map(e => Number.parseInt(e)).slice(0, -1));
+ L.stack[keyI] = new lobject.TValue(CT.LUA_TLNGSTR, indexes[i + 1].split('|').map(e => Number.parseInt(e)).slice(0, -1));
else
L.stack[keyI] = indexes[i + 1];
@@ -75,5 +79,6 @@ const luaH_next = function(L, table, keyI) {
return 0;
};
+module.exports.luaH_new = luaH_new;
module.exports.luaH_next = luaH_next;
module.exports.luaH_getn = luaH_getn;