From 2a6993bf0e23e2a3759abb9d7127525577dc346c Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Sun, 12 Mar 2017 16:48:53 +0100 Subject: Testing 8-bit strings --- src/ltm.js | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'src/ltm.js') diff --git a/src/ltm.js b/src/ltm.js index 51ab8ec..6377c93 100644 --- a/src/ltm.js +++ b/src/ltm.js @@ -38,8 +38,34 @@ const TMS = { TM_LT: "__lt", TM_LE: "__le", TM_CONCAT: "__concat", - TM_CALL: "__call", - TM_N: 26 + TM_CALL: "__call" +}; + +const TMS8 = { + TM_INDEX: lua.to_luastring(TMS.TM_INDEX), + TM_NEWINDEX: lua.to_luastring(TMS.TM_NEWINDEX), + TM_GC: lua.to_luastring(TMS.TM_GC), + TM_MODE: lua.to_luastring(TMS.TM_MODE), + TM_LEN: lua.to_luastring(TMS.TM_LEN), + TM_EQ: lua.to_luastring(TMS.TM_EQ), /* last tag method with fast access */ + TM_ADD: lua.to_luastring(TMS.TM_ADD), + TM_SUB: lua.to_luastring(TMS.TM_SUB), + TM_MUL: lua.to_luastring(TMS.TM_MUL), + TM_MOD: lua.to_luastring(TMS.TM_MOD), + TM_POW: lua.to_luastring(TMS.TM_POW), + TM_DIV: lua.to_luastring(TMS.TM_DIV), + TM_IDIV: lua.to_luastring(TMS.TM_IDIV), + TM_BAND: lua.to_luastring(TMS.TM_BAND), + TM_BOR: lua.to_luastring(TMS.TM_BOR), + TM_BXOR: lua.to_luastring(TMS.TM_BXOR), + TM_SHL: lua.to_luastring(TMS.TM_SHL), + TM_SHR: lua.to_luastring(TMS.TM_SHR), + TM_UNM: lua.to_luastring(TMS.TM_UNM), + TM_BNOT: lua.to_luastring(TMS.TM_BNOT), + TM_LT: lua.to_luastring(TMS.TM_LT), + TM_LE: lua.to_luastring(TMS.TM_LE), + TM_CONCAT: lua.to_luastring(TMS.TM_CONCAT), + TM_CALL: lua.to_luastring(TMS.TM_CALL) }; const luaT_typenames_ = [ @@ -77,7 +103,7 @@ const luaT_objtypename = function(L, o) { || (o.ttisfulluserdata() && o.metatable !== null)) { let name = o.__index(o, '__name'); if (name.ttisstring()) - return String.fromCharCode(...name.value); + return name.jsstring(); } return ttypename(o.ttnov()); -- cgit v1.2.3-54-g00ecf