[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: assert with formatting
- From: Pierre Chapuis <catwell@...>
- Date: Fri, 13 Jul 2018 16:23:29 +0200
> 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.