aboutsummaryrefslogtreecommitdiff
path: root/src/ltm.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-02-15 22:13:01 +0100
committerBenoit Giannangeli <giann008@gmail.com>2017-02-15 22:19:14 +0100
commit9d6afeba223c22163928557c69a102877223d3bd (patch)
tree481efe9bfaf1095792ca1612603ef3505352d1f8 /src/ltm.js
parent43474e4c411709e3c1ab1b1d13283d2bc4789d1d (diff)
downloadfengari-9d6afeba223c22163928557c69a102877223d3bd.tar.gz
fengari-9d6afeba223c22163928557c69a102877223d3bd.tar.bz2
fengari-9d6afeba223c22163928557c69a102877223d3bd.zip
Everything need to make luaL_newstate work, lua_pushnil test
Diffstat (limited to 'src/ltm.js')
-rw-r--r--src/ltm.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/ltm.js b/src/ltm.js
index f5c34b0..8b4f4f5 100644
--- a/src/ltm.js
+++ b/src/ltm.js
@@ -40,6 +40,13 @@ const TMS = {
TM_N: 26
};
+const luaT_init = function(L) {
+ L.l_G.tmname = [];
+ for (let event in TMS) {
+ L.l_G.tmname.push(new TValue(CT.LUA_TLNGSTR, TMS[event])); // Strings are already interned by JS
+ }
+};
+
const luaT_callTM = function(L, f, p1, p2, p3, hasres) {
let result = p3;
let func = L.top;
@@ -104,4 +111,5 @@ module.exports.luaT_callTM = luaT_callTM;
module.exports.luaT_callbinTM = luaT_callbinTM;
module.exports.luaT_trybinTM = luaT_trybinTM;
module.exports.luaT_callorderTM = luaT_callorderTM;
-module.exports.luaT_gettmbyobj = luaT_gettmbyobj; \ No newline at end of file
+module.exports.luaT_gettmbyobj = luaT_gettmbyobj;
+module.exports.luaT_init = luaT_init; \ No newline at end of file