From 3a77114269b53fc57ff00342af18e71f97dcf590 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Thu, 16 Feb 2017 07:35:26 +0100 Subject: luaL_newstate, lua_pushnil, lua_gettop, luaL_typename --- src/ltm.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src/ltm.js') diff --git a/src/ltm.js b/src/ltm.js index 8b4f4f5..77d65e4 100644 --- a/src/ltm.js +++ b/src/ltm.js @@ -40,6 +40,24 @@ const TMS = { TM_N: 26 }; +const luaT_typenames_ = [ + "no value", + "nil", + "boolean", + "userdata", + "number", + "string", + "table", + "function", + "userdata", + "thread", + "proto" /* this last case is used for tests only */ +]; + +const ttypename = function(t) { + return luaT_typenames_[t + 1]; +}; + const luaT_init = function(L) { L.l_G.tmname = []; for (let event in TMS) { @@ -112,4 +130,5 @@ module.exports.luaT_callbinTM = luaT_callbinTM; module.exports.luaT_trybinTM = luaT_trybinTM; module.exports.luaT_callorderTM = luaT_callorderTM; module.exports.luaT_gettmbyobj = luaT_gettmbyobj; -module.exports.luaT_init = luaT_init; \ No newline at end of file +module.exports.luaT_init = luaT_init; +module.exports.ttypename = ttypename; \ No newline at end of file -- cgit v1.2.3-54-g00ecf