aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ltable.js15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/ltable.js b/src/ltable.js
index ac12bd2..428ee5e 100644
--- a/src/ltable.js
+++ b/src/ltable.js
@@ -34,13 +34,16 @@ const table_hash = function(key) {
}
};
+class Table {
+ constructor(L) {
+ this.id = L.l_G.id_counter++;
+ this.strong = new Map();
+ this.metatable = null;
+ }
+}
+
const luaH_new = function(L) {
- let t = {
- id: L.l_G.id_counter++,
- strong: new Map(),
- metatable: null
- };
- return t;
+ return new Table(L);
};
const getgeneric = function(t, hash) {