summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-05-28 09:33:50 +0200
committerBenoit Giannangeli <giann008@gmail.com>2017-05-28 09:33:50 +0200
commitbaa9730a961ab2d1810a3093f63e2c66241a6b72 (patch)
tree44ed6955f020809ca8fcd2d842850ae11af46062 /tests
parent05d3720874c9a26f936db167e083b4ac07d6c6f7 (diff)
downloadfengari-baa9730a961ab2d1810a3093f63e2c66241a6b72.tar.gz
fengari-baa9730a961ab2d1810a3093f63e2c66241a6b72.tar.bz2
fengari-baa9730a961ab2d1810a3093f63e2c66241a6b72.zip
ltests.js: func2num behaves like topointer
Diffstat (limited to 'tests')
-rw-r--r--tests/test-suite/ltests.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/test-suite/ltests.js b/tests/test-suite/ltests.js
index 0ffe212..13b4774 100644
--- a/tests/test-suite/ltests.js
+++ b/tests/test-suite/ltests.js
@@ -166,7 +166,9 @@ const runJS = function(L, L1, pc) {
}
case "func2num": {
let func = lua.lua_tocfunction(L1, getindex(L, L1, pc));
- lua.lua_pushnumber(L1, NaN); // TOODO
+ if (func === null) func = 0;
+ else if (func.id) func = func.id;
+ lua.lua_pushnumber(L1, func);
break;
}
case "getfield": {
@@ -442,7 +444,7 @@ const runJS = function(L, L1, pc) {
case "topointer": {
let p = lua.lua_topointer(L1, getindex(L, L1, pc));
if (p === null) p = 0;
- else if (p.id) p = p.id;
+ else if (p.id) p = p.id;
lua.lua_pushnumber(L1, p); /* in ltests.c, p is casted to a size_t so NULL gives 0 */
break;
}