lua-users home
lua-l archive

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

>The table is pushed on the stack and everything works
>great, but it would be nicer if I didn't need the
>return. Has anyone modified Lua to implicitly pick up
>the function return value and return it from the
>chunk? Or any pointers on how I might go about doing that?

In Lua 4.0 (and perhaps 3.2), it's a simple matter of taking the bytecode for
the chunk and changing a CALL opcode to a TAILCALL.
Compare the output of luac -l on "f{10,20}" with "return f{10,20}".