lua-users home
lua-l archive

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

> From  Tue Jul 20 03:23:13 1999
> 	You are probably best to use goto to get out of an error condition
> when in deeply nested code, tagmethods can work
> 	like exceptions in this case and jump you out.  
> 	It's unfortunate that 'return' has to be the last statement in a
> function, it would be quite useful in these circumstances if it
> 	could be used anywhere.

I wasn't aware this was the case.  Where is this documented?

Can you show an example of using tagmethods like exceptions?

> > I don't think I *really* need my microwave oven, or my automobile,
> > but I find them convenient tools to have around at certain times.
> > 
> > "Djikstra considered harmful"
> > 
> > I don't think Lua *really* needs 'repeat' and 'if'.  After all,
> > 'while' should be sufficient for doing everything these other
> > keywords do.  However, I sometimes find it convenient to use one
> > or the other, depending on what the task at hand is.
> > 
> > There are actually a small handful of algorithms where the code
> > actually does look cleaner with a 'goto' than it would with
> > other constructs.  Most languages have some kind of construct
> > for unconditional, non-returning branches.
> > 
> > --Adam