diff options
Diffstat (limited to 'src/lauxlib.js')
-rw-r--r-- | src/lauxlib.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lauxlib.js b/src/lauxlib.js index d976cee..0c42a05 100644 --- a/src/lauxlib.js +++ b/src/lauxlib.js @@ -493,13 +493,14 @@ const luaL_tolstring = function(L, idx) { case lua.LUA_TNIL: lua.lua_pushliteral(L, "nil"); break; - default: + default: { let tt = luaL_getmetafield(L, idx, lua.to_luastring("__name", true)); let kind = tt === lua.LUA_TSTRING ? lua.lua_tostring(L, -1) : luaL_typename(L, idx); lua.lua_pushfstring(L, lua.to_luastring("%s: %p"), kind, lua.lua_topointer(L, idx)); if (tt !== lua.LUA_TNIL) lua.lua_remove(L, -2); break; + } } } @@ -708,13 +709,13 @@ class LoadF { constructor() { this.n = NaN; /* number of pre-read characters */ this.f = null; /* file being read */ - this.buff = WEB ? new Array(1024) : new Buffer(1024); /* area for reading file */ + this.buff = typeof process === "undefined" ? new Array(1024) : new Buffer(1024); /* area for reading file */ this.pos = 0; /* current position in file */ this.err = void 0; } } -if (WEB) { +if (typeof process === "undefined") { const getF = function(L, ud) { let lf = ud; @@ -858,7 +859,7 @@ const luaL_dofile = function(L, filename) { const lua_writestringerror = function() { for (let i=0; i<arguments.length; i++) { let a = arguments[i]; - if (WEB) { + if (typeof process === "undefined") { if (typeof a !== "string") a = lua.to_jsstring(a); console.error(a); |