From de072f1a1819d6d4b41205dcc985b5d23bf9c43a Mon Sep 17 00:00:00 2001 From: daurnimator Date: Fri, 5 May 2017 17:23:08 +1000 Subject: src/ltable.js: Create Table class This way it's pretty in debug output. --- src/ltable.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/ltable.js') 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) { -- cgit v1.2.3-54-g00ecf