lua-users home
lua-l archive

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



On 25-Jan-07, at 3:01 PM, Alex Queiroz wrote:

Hallo,

On 1/25/07, Jan Schütze <JanS@dracoblue.de> wrote:

This isn't only used to report an error to users on website.
Since I use lua for webpublishing, I have somewher ein my source a
function called xml_render() - this one, should use die at the end, to
prevent from showing header and stuff when the rest of the script is
executed. The issue is, that this function is called mostly somewhere in
a set of sets of function-sets, so its not possible (easily, without
making the source unreadable) to do this via using if-else-constructs.


    You can catch the error before it reaches the user with pcall().


Another simple solution is to make the outermost function a coroutine and define exit = coroutine.yield