For example when checking if a permission is set;
if variable_with_permissions & ~perms.owner_write == perms.owner_write then
-- ...
end
1) The '== perms.owner_write' part is required because an if-statement evaluates uservalues as true.
'__eq' metamethod is only called when both operands are a table or userdata.
2) The '&' and '~' operators create a new uservalues that are immediately garbage.
To solve the boolean issue, I would suggest adding a method to `perms` objects. Example:
if perms.owner_write:in(variable_with_permissions) then
-- ...
end
...except `in` is a reserved keyword and I don't know what would best replace it. (Naming things is hard!)