diff options
author | Benoit Giannangeli <benoit.giannangeli@boursorama.fr> | 2017-02-22 09:00:12 +0100 |
---|---|---|
committer | Benoit Giannangeli <benoit.giannangeli@boursorama.fr> | 2017-02-22 09:00:12 +0100 |
commit | a40719dc74b8dbb0d6c8fc0272c0d79ad8a7a9ea (patch) | |
tree | a87cbfa7d3e7620b64681f3f738320c58be0f469 /src/lapi.js | |
parent | dbe2a3bf2ef8c053e6c596c99e29eb27b6118f1b (diff) | |
download | fengari-a40719dc74b8dbb0d6c8fc0272c0d79ad8a7a9ea.tar.gz fengari-a40719dc74b8dbb0d6c8fc0272c0d79ad8a7a9ea.tar.bz2 fengari-a40719dc74b8dbb0d6c8fc0272c0d79ad8a7a9ea.zip |
select
Diffstat (limited to 'src/lapi.js')
-rw-r--r-- | src/lapi.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/lapi.js b/src/lapi.js index e149619..bc4dd54 100644 --- a/src/lapi.js +++ b/src/lapi.js @@ -472,6 +472,22 @@ const lua_tonumber = function(L, idx) { return lvm.tonumber(index2addr(L, idx)) }; +const lua_topointer = function(L, idx) { + let o = index2addr(L, idx); + switch (o.ttype()) { + case CT.LUA_TTABLE: + case CT.LUA_TLCL: + case CT.LUA_TCCL: + case CT.LUA_TLCF: + case CT.LUA_TTHREAD: + case CT.LUA_TUSERDATA: + case CT.LUA_TLIGHTUSERDATA: + return o.value; + default: + return null; + } +}; + const f_call = function(L, ud) { ldo.luaD_callnoyield(L, ud.funcOff, ud.nresults); }; @@ -653,6 +669,7 @@ module.exports.lua_tointeger = lua_tointeger; module.exports.lua_toboolean = lua_toboolean; module.exports.lua_tolstring = lua_tolstring; module.exports.lua_tostring = lua_tostring; +module.exports.lua_topointer = lua_topointer; module.exports.lua_load = lua_load; module.exports.lua_callk = lua_callk; module.exports.lua_call = lua_call; |