This commit is contained in:
NoryiE
2025-02-16 19:31:38 +00:00
parent dd6825f3b6
commit 056897dd1b
36 changed files with 1085 additions and 5065 deletions

View File

@@ -1,35 +1 @@
local errorManager = require("errorManager")
-- Simple type checking without stack traces
local function expect(position, value, expectedType)
local valueType = type(value)
if expectedType == "element" then
if valueType == "table" and value.get("type") ~= nil then
return true
end
end
if expectedType == "color" then
if valueType == "number" and value >= 1 and value <= 32768 then
return true
end
if valueType == "string" and colors[value] then
return true
end
end
if valueType ~= expectedType then
errorManager.header = "Basalt Type Error"
errorManager.error(string.format(
"Bad argument #%d: expected %s, got %s",
position,
expectedType,
valueType
))
end
return true
end
return expect
Simple type checking without stack traces