lua-users home
lua-l archive

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



On 16/12/14 11:18 PM, Sean Conner wrote:
It was thus said that the Great Soni L. once stated:
You know, we have error(), but it uses pcall... How can I add a Return()
function, coupled to the core? (because I'm pretty sure it's impossible
to do it with a lib)
   Could you go into more detail about the problem that this will solve?  Or
at least, how it would look in source?

   -spc


if x or Return(nil, "missing x") then ... end

vs

if not x then
  return nil, "missing x"
else
  ...
end

It's literally a function like error() tightly coupled to the core, and doesn't replace the 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.