diff options
| author | Benoit Giannangeli <giann008@gmail.com> | 2017-05-28 09:33:50 +0200 | 
|---|---|---|
| committer | Benoit Giannangeli <giann008@gmail.com> | 2017-05-28 09:33:50 +0200 | 
| commit | baa9730a961ab2d1810a3093f63e2c66241a6b72 (patch) | |
| tree | 44ed6955f020809ca8fcd2d842850ae11af46062 /tests/test-suite/ltests.js | |
| parent | 05d3720874c9a26f936db167e083b4ac07d6c6f7 (diff) | |
| download | fengari-baa9730a961ab2d1810a3093f63e2c66241a6b72.tar.gz fengari-baa9730a961ab2d1810a3093f63e2c66241a6b72.tar.bz2 fengari-baa9730a961ab2d1810a3093f63e2c66241a6b72.zip | |
ltests.js: func2num behaves like topointer
Diffstat (limited to 'tests/test-suite/ltests.js')
| -rw-r--r-- | tests/test-suite/ltests.js | 6 | 
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;          } | 
