2020-09-19 13:41:24 +02:00
|
|
|
local error = error
|
|
|
|
local concat = table.concat
|
|
|
|
|
|
|
|
local Public = {}
|
|
|
|
|
|
|
|
function Public.equal(a, b, optional_message)
|
|
|
|
if a == b then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2020-09-19 15:48:08 +02:00
|
|
|
local message = {tostring(a), ' ~= ', tostring(b)}
|
2020-09-19 13:41:24 +02:00
|
|
|
if optional_message then
|
2020-09-19 15:48:08 +02:00
|
|
|
message[#message + 1] = ' - '
|
|
|
|
message[#message + 1] = optional_message
|
2020-09-19 13:41:24 +02:00
|
|
|
end
|
2020-09-19 15:48:08 +02:00
|
|
|
|
|
|
|
message = concat(message)
|
2020-09-19 13:41:24 +02:00
|
|
|
error(message, 2)
|
|
|
|
end
|
|
|
|
|
2020-09-19 15:48:08 +02:00
|
|
|
function Public.is_true(condition, optional_message)
|
|
|
|
if not condition then
|
|
|
|
error(optional_message or 'condition was not true', 2)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-09-19 13:41:24 +02:00
|
|
|
return Public
|