aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-05 17:23:08 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-05 17:23:08 +1000
commitde072f1a1819d6d4b41205dcc985b5d23bf9c43a (patch)
tree76ad14daa7a8e4c553b8479e9cffcbbdcec375f4 /src
parent0e5585bd7078d6727382c0de51161fe377c1d81d (diff)
downloadfengari-de072f1a1819d6d4b41205dcc985b5d23bf9c43a.tar.gz
fengari-de072f1a1819d6d4b41205dcc985b5d23bf9c43a.tar.bz2
fengari-de072f1a1819d6d4b41205dcc985b5d23bf9c43a.zip
src/ltable.js: Create Table class
This way it's pretty in debug output.
Diffstat (limited to 'src')
-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) {