lua-users home
lua-l archive

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


I know that this has been addressed before, but I can't find it for the life of me.  My question is:

Is there an integrated way (or even a hack) to halt the execution of a Lua chunk.  What I would like is something like:

print ("hello");
print ("world");

would produce:


That is, the fictional "breakfromscript" call would stop excution of the current script (from pcall).  Kind of like doing a return from a function.

This would be really helpful as a way to short circuit script executions in lengthy scripts.  I know that there are all sorts of "good" ways to do this like using if.. else and using functions, but it wouldbe helpful to our customers if there was a way to just tell the Lua engine to simply stop executing the current script chunk.

I am even willing to put a small hack into the Lua engine source code if one exists.


- Brett