lua-users home
lua-l archive

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

On 20/12/14 07:27 PM, Sean Conner wrote:
It was thus said that the Great Soni L. once stated:
So let's say I'm hacking the internals and I wanna force a Lua function
to stop and just return whatever I want instead of continuing and/or
returning what it wants to return. How can I do this?
   Um ... insert a return statement where you want it to return, with the
data you want to return?


I want `return Return()` inside a string.gsub to make the string.gsub return whatever I pass to the Return function. I want to be able to pass a function as a callback and force the called function to return early. I want to be able to `x = x and ((x == y and Return()) or (x == z and a)) or b`. I can't do any of this with a plain return statement.

Disclaimer: these emails are public and can be accessed from <TODO: get a non-DHCP IP and put it here>. If you do not agree with this, DO NOT REPLY.