From e3f76f864ecb0039c3c3c4ae33ffac21b64b704e Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Sat, 27 May 2017 10:04:07 +0200 Subject: ltests.js: topointer does not always work like C version would --- tests/test-suite/ltests.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tests/test-suite') diff --git a/tests/test-suite/ltests.js b/tests/test-suite/ltests.js index 8b79a48..0ffe212 100644 --- a/tests/test-suite/ltests.js +++ b/tests/test-suite/ltests.js @@ -441,7 +441,9 @@ const runJS = function(L, L1, pc) { } case "topointer": { let p = lua.lua_topointer(L1, getindex(L, L1, pc)); - lua.lua_pushnumber(L1, p !== null ? p : 0); /* in ltests.c, p is casted to a size_t so NULL gives 0 */ + if (p === null) p = 0; + 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; } case "tostring": { @@ -466,7 +468,6 @@ const runJS = function(L, L1, pc) { } case "yield": { return lua.lua_yield(L1, getnum(L, L1, pc)); - break; } case "yieldk": { let nres = getnum(L, L1, pc); -- cgit v1.2.3-70-g09d2