lua-users home
lua-l archive

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


Semantics of Lua `not'?

The `not` operator is a boolean operator, in lua any value is considered "truthy" except `false` and `nil`.  The check you want instead is:
        if bottle_count == 0 then break end

Some examples of how `not` works:
       not 1 -- this is false
       not nil -- this is true
       not 0 -- this is false

Hope this helps 😊