From 6d07675c7397e351c8c15ae961f8ad06c3f9d8a6 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Wed, 26 Apr 2017 22:57:35 +1000 Subject: Remove lightuserdata object subtype --- src/defs.js | 3 --- src/lapi.js | 9 +-------- src/lobject.js | 8 -------- src/lstrlib.js | 2 +- src/lua.js | 1 - 5 files changed, 2 insertions(+), 21 deletions(-) diff --git a/src/defs.js b/src/defs.js index e24f419..fd8038a 100644 --- a/src/defs.js +++ b/src/defs.js @@ -66,9 +66,6 @@ const constant_types = { constant_types.LUA_TSHRSTR = constant_types.LUA_TSTRING | (0 << 4); /* short strings */ constant_types.LUA_TLNGSTR = constant_types.LUA_TSTRING | (1 << 4); /* long strings */ -constant_types.LUA_TLIGHTUSERDATA_PTR = constant_types.LUA_TLIGHTUSERDATA | (0 << 4); /* short strings */ -constant_types.LUA_TLIGHTUSERDATA_OBJ = constant_types.LUA_TLIGHTUSERDATA | (1 << 4); /* long strings */ - constant_types.LUA_TNUMFLT = constant_types.LUA_TNUMBER | (0 << 4); /* float numbers */ constant_types.LUA_TNUMINT = constant_types.LUA_TNUMBER | (1 << 4); /* integer numbers */ diff --git a/src/lapi.js b/src/lapi.js index eeb4137..6d75e44 100644 --- a/src/lapi.js +++ b/src/lapi.js @@ -299,13 +299,7 @@ const lua_pushboolean = function(L, b) { }; const lua_pushlightuserdata = function(L, p) { - L.stack[L.top++] = new TValue(CT.LUA_TLIGHTUSERDATA_PTR, p); - - assert(L.top <= L.ci.top, "stack overflow"); -}; - -const lua_pushobject = function(L, p) { - L.stack[L.top++] = new TValue(CT.LUA_TLIGHTUSERDATA_OBJ, p); + L.stack[L.top++] = new TValue(CT.LUA_TLIGHTUSERDATA, p); assert(L.top <= L.ci.top, "stack overflow"); }; @@ -1071,7 +1065,6 @@ module.exports.lua_pushliteral = lua_pushliteral; module.exports.lua_pushlstring = lua_pushlstring; module.exports.lua_pushnil = lua_pushnil; module.exports.lua_pushnumber = lua_pushnumber; -module.exports.lua_pushobject = lua_pushobject; module.exports.lua_pushstring = lua_pushstring; module.exports.lua_pushthread = lua_pushthread; module.exports.lua_pushtvalue = lua_pushtvalue; diff --git a/src/lobject.js b/src/lobject.js index bd65ea8..c2ec123 100644 --- a/src/lobject.js +++ b/src/lobject.js @@ -64,14 +64,6 @@ class TValue { return this.checktag(CT.LUA_TLIGHTUSERDATA); } - ttisobject() { - return this.checktag(CT.LUA_TLIGHTUSERDATA_OBJ); - } - - ttisptr() { - return this.checktag(CT.LUA_TLIGHTUSERDATA_PTR); - } - ttisstring() { return this.checktype(CT.LUA_TSTRING); } diff --git a/src/lstrlib.js b/src/lstrlib.js index 950dca0..370e672 100644 --- a/src/lstrlib.js +++ b/src/lstrlib.js @@ -1262,7 +1262,7 @@ const str_gmatch = function(L) { let lp = p.length; lua.lua_settop(L, 2); /* keep them on closure to avoid being collected */ let gm = new GMatchState(); - lua.lua_pushobject(L, gm); + lua.lua_pushlightuserdata(L, gm); prepstate(gm.ms, L, s, ls, p, lp); gm.src = 0; gm.p = 0; diff --git a/src/lua.js b/src/lua.js index 047926f..ce0def4 100644 --- a/src/lua.js +++ b/src/lua.js @@ -144,7 +144,6 @@ module.exports.lua_pushliteral = lapi.lua_pushliteral; module.exports.lua_pushlstring = lapi.lua_pushlstring; module.exports.lua_pushnil = lapi.lua_pushnil; module.exports.lua_pushnumber = lapi.lua_pushnumber; -module.exports.lua_pushobject = lapi.lua_pushobject; module.exports.lua_pushstring = lapi.lua_pushstring; module.exports.lua_pushthread = lapi.lua_pushthread; module.exports.lua_pushtvalue = lapi.lua_pushtvalue; -- cgit v1.2.3-54-g00ecf