lua-users home
lua-l archive

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


I think the real problem here is the difference between returning error codes in some form vs throwing exceptions. The code below could be cleaned up usin pcall(), but often this is as cumbersome as introducing extra return values to flag errors.

To my mind no language has yet tackled the probl of error returns/exceptions well ... C++ etc is ghastly in many ways, and Lua too suffers from problems because its cumbersome to call a function that returns either valid return or nil+error.

--Tim

On Oct 21, 2012, at 10:55 AM, Egor Skriptunoff <egor.skriptunoff@gmail.com> wrote:

>>  if     ( passed, z = myFunction(x, y) )
>>     and ( passed, q = mySecondFunction(z) )
>>     and ( passed, result = myThirdFunction(q) )