Fixed unary negation and to-string bigint metamethods

This commit is contained in:
Ishaan Bhardwaj 2021-05-29 19:48:34 -04:00
parent ae1231c47a
commit 50466c5902

View File

@ -12,8 +12,8 @@ local mt = {
__add = function(lhs, rhs) __add = function(lhs, rhs)
return bigint.add(lhs, rhs) return bigint.add(lhs, rhs)
end, end,
__unm = function() __unm = function(arg)
return bigint.negate(self) return bigint.negate(arg)
end, end,
__sub = function(lhs, rhs) __sub = function(lhs, rhs)
return bigint.subtract(lhs, rhs) return bigint.subtract(lhs, rhs)
@ -30,8 +30,8 @@ local mt = {
__pow = function(lhs, rhs) __pow = function(lhs, rhs)
return bigint.exponentiate(lhs, rhs) return bigint.exponentiate(lhs, rhs)
end, end,
__tostring = function() __tostring = function(arg)
return bigint.unserialize(self, "s") return bigint.unserialize(arg, "s")
end, end,
__eq = function(lhs, rhs) __eq = function(lhs, rhs)
return bigint.compare(lhs, rhs, "==") return bigint.compare(lhs, rhs, "==")