From baa9730a961ab2d1810a3093f63e2c66241a6b72 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Sun, 28 May 2017 09:33:50 +0200 Subject: ltests.js: func2num behaves like topointer --- tests/test-suite/ltests.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tests/test-suite') 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; } -- cgit v1.2.3-70-g09d2