fix(scripting/lua): support exported MRVs #681
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I believe this is quite hacky and could be done cleaner, however, this is the only approach I could think of.
The issue is that MRVs aren't properly handled with the Lua ScRT because of it only returning the second parameter of
pcall, which does not take into account MRVs. The only way to actually ensure that all MRVs are a gotten is through packing thepcallreturn values and handling it's return as normal, afterward we just check if the pack is >2 (has 2+ MRVs) and if so, we just remove 1st index and unpack. Othewise, just return the second retval of thepcall(first is status of thepcall).Some tests for ensuring no regressions are introduced with these changes:
Lua
Setting in Lua and also getting
JavaScript
Only getting in JavaScript
JavaScript behaviour of getting Lua export MRVs was always just packing into an array.
Expected output from running the above code:
