lua-users home
lua-l archive

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




On Tue, Feb 23, 2021 at 9:03 AM Soni "They/Them" L. <fakedme@gmail.com> wrote:
Uh bools currently don't have xor so instead you have to write silly
things like

local a = ...
local b = ...
if (a and not b) or (b and not a) then
   ...
end

And it'd look way cleaner with xor

if ... ~ ... then
   ...
end

Thoughts?

If both values are booleans (false or true) then you can do this:
local a = ...
local b = ...
if a ~= b then
...
end

Otherwise do
if not a ~= not b then 
   ...
end


--