Skip to content

Commit

Permalink
Fix pluto_extract for function and table when they're not the last value
Browse files Browse the repository at this point in the history
  • Loading branch information
Sainan committed Jan 21, 2024
1 parent 9e32314 commit 7aa52d7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plutoscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ function pluto_extract(coro, nvals)
break;

case LUA_TFUNCTION:
lib.lua_pushvalue(coro, -1);
lib.lua_pushvalue(coro, -(nvals-i));
let ref = lib.luaL_ref(coro, LUA_REGISTRYINDEX);
vals.push(function()
{
Expand All @@ -267,7 +267,7 @@ function pluto_extract(coro, nvals)

case LUA_TTABLE:
let obj = {};
lib.lua_pushvalue(coro, -1);
lib.lua_pushvalue(coro, -(nvals-i));
lib.lua_pushnil(coro);
while (lib.lua_next(coro, -2))
{
Expand Down

0 comments on commit 7aa52d7

Please sign in to comment.