lua-users home
lua-l archive

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


Well, it just will make things slower.
I've applied the patch for me anyway.
But I think it may be added to official versions.

On Sat, Jun 25, 2011 at 11:42 PM, Lorenzo Donati
<lorenzodonatibz@interfree.it> wrote:
> On 25/06/2011 21.21, Rebel Neurofog wrote:
>>
>> But that's not the assert () way.
>> I can't create assertable function like:
>>
>> function ob.method ()
>>    return func (), get_error
>> end
>>
>> and then call it using assert ()
>>
>> Kinda no chaining...
>>
>>
>>
>
> Ok, that's true.
>
> But you didn't mention this use case in your previous post.
>
> Anyway isn't it sufficient to roll your own specialized "assert" to be used
> in your code?
>
> -----------------------------------------------
> local function new_assert( condition, err )
>  if not condition then
>      if type( err ) == 'function' then
>         assert( false, err() )
>      else
>         assert( false, err )
>      end
>  end
> end
> -----------------------------------------------
>
>