Re: Implicit return from chunk
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Implicit return from chunk
 
- From: Luiz Henrique de Figueiredo <lhf@...>
 
- Date: 2001年4月24日 20:57:08 -0300
 
>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}".
--lhf