lua-users home
lua-l archive

Re: try..catch for Lua 5.2?

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


>> Since there is no "begin" in lua, I'll wote for leaving out "try".
>
> What do you mean by "begin"? If you want an explicit lexical scope,
> you can always use do...end.
There is no reason to start a block with "try" in lua.
function luafunc()
 local l
 livelongandprosper()
catch E
 print E.message
end
and if you want to do exception handlig on block
function luafunc()
 local l
 do
 livelongandprosper()
 catch E
 print E.message
 end
 here_even_if_things_went_wrong()
end

AltStyle によって変換されたページ (->オリジナル) /