lua-users home
lua-l archive

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


On Mon, Sep 21, 2015 at 5:03 PM, Jonathan Hunter
<jhunter@voxboxcoms.co.uk> wrote:
> I want it to exit the loop/function on true and not return any of the other
> entries,so in affect matches on first priority entry and stops there.

You can use the "break" keyword to exit the innermost loop
immediately, or the "return" keyword to immediately exit the current
function, including all loops within that function (and possibly send
value(s) back to the caller, by "return <value>").

Note that when using "break", you immediately lose any local variables
whose scope is the loop itself, including the loop variables
themselves, so be sure to store the entry in another variable before
"break"ing.

Beyond that, your database code is all Greek to me. :-) (One of these
days, I should learn some SQL. Might help me with a personal project
I'd like to do eventually.)