summaryrefslogtreecommitdiff
path: root/src/lapi.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-24 14:32:35 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-24 14:38:40 +1000
commite980731dbddb46260d7287373a2cb3a835e30e5a (patch)
tree293aaf74a8299aa2b667a262cfc9767773c4befd /src/lapi.js
parent9f43d27b4377b1d3e166657a608dad91668c7909 (diff)
downloadfengari-e980731dbddb46260d7287373a2cb3a835e30e5a.tar.gz
fengari-e980731dbddb46260d7287373a2cb3a835e30e5a.tar.bz2
fengari-e980731dbddb46260d7287373a2cb3a835e30e5a.zip
Give userdata objects a class
This way their type can be checked via `instanceof`
Diffstat (limited to 'src/lapi.js')
-rw-r--r--src/lapi.js8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/lapi.js b/src/lapi.js
index 8e0c491..ae9fa89 100644
--- a/src/lapi.js
+++ b/src/lapi.js
@@ -511,13 +511,7 @@ const lua_createtable = function(L, narray, nrec) {
};
const luaS_newudata = function(L, size) {
- return {
- id: L.l_G.id_counter++,
- metatable: null,
- uservalue: new lobject.TValue(CT.LUA_TNIL, null),
- len: size,
- data: Object.create(null) // ignores size argument
- };
+ return new lobject.Udata(L, size);
};
const lua_newuserdata = function(L, size) {