I was bored and so decided to do a module for Logic/Binary Gates.
Luau already has not, and and or gates, so I did the 4 others here.
local BitModule = {Bits={}}
BitModule.___Index = BitModule
-- for binary, it is of-course 0s or 1s. But for this system, we will be using false and true, which works the same way.
-- this function converts 1 and 0s into true and false
function BitModule:ConvertBinary(A)
return A==1
end
function BitModule:Nand(A,B)
return(not(A and B))
end
function BitModule:Nor(A,B)
return(not(A or B))
end
function BitModule:Xor(A,B)
return BitModule:Nand((A and B),(A or B))
end
function BitModule:NXor(A,B)
return not(BitModule:Xor(A,B))
end
return BitModule