lua-users home
lua-l archive

Lua parser question re function calls in local statement

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,
For following Lua code:
 local d, e = f()
The byte-code generated looks like:
 1 [1] GETTABUP 0 0 -1 ; _ENV "f"
 2 [1] CALL 0 1 3
 3 [1] RETURN 0 1
And for following:
 local d, e; d, e = f()
We get:
 1 [1] LOADNIL 0 1
 2 [1] GETTABUP 2 0 -1 ; _ENV "f"
 3 [1] CALL 2 1 3
 4 [1] MOVE 1 3
 5 [1] MOVE 0 2
 6 [1] RETURN 0 1
My question is this:
I want to change the code generated for the first case - to capture
the return values from the CALL into temporary registers and then MOVE
them to the locals. I think I need to make changes in localstat()
function in lparser.c but I can't figure out how to do this - would
appreciate any help / tips.
Thanks and Regards
Dibyendu

AltStyle によって変換されたページ (->オリジナル) /