[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: help with lua style and syntax
- From: Tim Hill <drtimhill@...>
- Date: Sun, 21 Oct 2012 11:37:50 -0700
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) )