lua-users home
lua-l archive

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


Sigh, I meant to say that a chunk that has been <<run>>, not merely
<<loaded>>.


>4. While it might seem somewhat strange, you can remove the text "main"
from
>your example script.  A loaded chunk has a return value.  In the absence of
>an explicit return statement, the return value is the value of the last
>expression evaluated, so running a script that says....
>
>function(x,y,z) end
>
>will return a function that takes 3 parameters, and you can store off this
>function and call it either immediately or later.

Not true. There is no implicit return value. You're mistaking the function
that represents the "main" part of the chunk (which is what lua_load leaves
on the stack) for this.
--lhf