Skip to content

Fix luaref returned from call<>()#222

Merged
kunitoki merged 1 commit intomasterfrom
dev/fix_call_luaref
Apr 24, 2026
Merged

Fix luaref returned from call<>()#222
kunitoki merged 1 commit intomasterfrom
dev/fix_call_luaref

Conversation

@kunitoki
Copy link
Copy Markdown
Owner

@kunitoki kunitoki commented Apr 24, 2026

This pull request improves the handling of Lua function return values as C++ tuples and adds a new test case to verify support for tuples containing LuaRef objects. The main change refactors how tuple results are decoded from the Lua stack to be more robust and efficient.

Tuple result decoding improvements:

  • Refactored decode_tuple_result in Invoke.h to first collect all stack elements into a tuple of std::optional values, then check for errors and construct the result tuple in a single step. This streamlines error handling and avoids partially constructed tuples.

Testing enhancements:

  • Added a new test CallReturningTupleWithLuaRef in LuaRefTests.cpp to verify that Lua functions returning a tuple with a table (as a LuaRef) are correctly handled, including checking table contents.

@kunitoki kunitoki linked an issue Apr 24, 2026 that may be closed by this pull request
@kunitoki kunitoki merged commit 7f63305 into master Apr 24, 2026
45 checks passed
@kunitoki kunitoki deleted the dev/fix_call_luaref branch April 24, 2026 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Breaking change in 3.0-rc6 with multiple returned results from call

1 participant