lua-users home
lua-l archive

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


>   Um, but wouldn't
> 
>   format_assert(a == 1 , "'a' should be '%d', but was '%s'",1,tostring(a))
> 
> *also* compose the message even if a equals 1?  Lua doesn't do lazy
> evaluation.

It would call `tostring(a)` in all cases, but it would not call `string.format` because that branch of the `if` would never be evaluated.

I am not entirely sure if there is a real performance gain, though.