lua-users home
lua-l archive

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


I went with

if (0 < i && i <= 256 && !lua_isnone(L, lua_upvalueindex(i))) { ... }

— Gabriel

On Thu, Dec 20, 2018 at 5:17 PM Stephen Irons <stephen@irons.nz> wrote:
>
>
>
> On Fri, Dec 21, 2018 at 6:12 AM, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
>
> Thank you, that simplifies the code. [...]
>
> - if (!lua_isnone(L, lua_upvalueindex(i))) { + if (0 < i <= 256 && !lua_isnone(L, lua_upvalueindex(i))) {
>
>
> I don't think the expression (0 < i <= 256) does what you expect in C. Do you mean ((i > 0) && (i <= 256)), or perhaps this was intended as psuedo-code?
>
> -- Roberto