utils.type: Add is_boolean(), is_REField(), is_REMethodDefinition()

This commit is contained in:
GreenComfyTea
2023-08-21 17:25:07 +03:00
parent f9c1d89843
commit 2db41e237f

View File

@@ -44,6 +44,7 @@ local unicode_chars;
local epsilon = 0.000001;
this.table = {};
this.type = {};
this.number = {};
this.string = {};
this.vec2 = {};
@@ -215,6 +216,18 @@ function this.table.merge(...)
return result;
end
function this.type.is_boolean(value)
return value == true or value == false;
end
function this.type.is_REField(value)
return value.get_return_type == nil;
end
function this.type.is_REMethodDefinition(value)
return value.get_return_type ~= nil;
end
function this.number.is_NaN(value)
return tostring(value) == tostring(0/0);
end