lua-users home
lua-l archive

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



On Sep 17, 2016, at 11:41 PM, Russell Haley <russ.haley@gmail.com> wrote:

Lua 5.3.3  Copyright (C) 1994-2016 Lua.org, PUC-Rio
% not 5 == 5
false
% not 5 == 6
false


This is a precedence problem (for humans, not Lua):

In Lua, “not 5 == 5” is actually “(not 5) == 5”, rather than *not (5 == 5)”. Since “5” is true in a boolean context, “not 5” is false, so you are really doing “false == 5”, which is of course false. The same is also true for “not 5 == 6”, or “not 5 == 500” for that matter,

—Tim