lua-users home
lua-l archive

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


On Fri, Sep 27, 2013 at 2:30 PM, petah <lua@laufenberg.ch> wrote:
> (try/catch sure would be nice to have!)

It would if there were free, but they're not :)
I wonder what all the cost would be? I'm thinking of them as essentially a syntax sugar for pcall/xpcall, so:
try
    do_things()
catch(ex)
    report_error(ex)
end

would translate to:
local ok, ex = pcall(function() --or xpcall?
    do_things()
end); if not ok then
    report_error(ex)
end

the idea being to just make it a little less ugly. :)


--
Sent from my Game Boy.