aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-05-27 10:04:07 +0200
committerBenoit Giannangeli <giann008@gmail.com>2017-05-27 10:04:07 +0200
commite3f76f864ecb0039c3c3c4ae33ffac21b64b704e (patch)
tree1ca5f6c994a309f008e3650d04c0fa7ac63c0d4e
parent1c1e3795d05e297b702cbe9fc0e9af688e6f49e7 (diff)
downloadfengari-e3f76f864ecb0039c3c3c4ae33ffac21b64b704e.tar.gz
fengari-e3f76f864ecb0039c3c3c4ae33ffac21b64b704e.tar.bz2
fengari-e3f76f864ecb0039c3c3c4ae33ffac21b64b704e.zip
ltests.js: topointer does not always work like C version would
-rw-r--r--tests/test-suite/ltests.js5
1 files changed, 3 insertions, 2 deletions
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);