lua-users home
lua-l archive

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


On 2/20/06, Rob Shaw <> wrote:
> this wasn't instantly obvious to me either.  could I ask this-
> say you just do
> > loadfile 'test.lua'
> the stuff is sitting on the stack, but you haven't named it.
> is there any way in lua to execute the top of the stack, without the label?
> what happens to it, does it get over-written by the next call to loadfile(),
> or does it get garbage-collected?

     You can write:

> (loadfile"test.lua")()

     If you don't assign it or don't execute it, it'll be garbage collected.