Bastion aims to serve as a highly performant, simplisitic, and expandable World of Warcraft data visualization framework.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Bastion/src/Util/Util.lua

82 lines
1.6 KiB

---@type Tinkr
local Tinkr,
---@class Bastion
Bastion = ...
---@class Bastion.Util
local Util = {}
---@enum (key) CompareThisTable
local compareThisTable = {
[">"] = function(A, B) return A > B end,
["<"] = function(A, B) return A < B end,
[">="] = function(A, B) return A >= B end,
["<="] = function(A, B) return A <= B end,
["=="] = function(A, B) return A == B end,
["min"] = function(A, B) return A < B end,
["max"] = function(A, B) return A > B end,
}
---@generic A
---@param operator CompareThisTable
---@param a A
---@param b A
function Util:CompareThis(operator, a, b)
end
local PrintEnabled = false
function Util:Print(...)
if not PrintEnabled then
return
end
local args = { ... }
local str = "|cFFDF362D[Bastion]|r |cFFFFFFFF"
for i = 1, #args do
str = str .. tostring(args[i]) .. " "
end
print(str)
end
function Util:TogglePrint()
PrintEnabled = not PrintEnabled
if PrintEnabled then
Util:Print("Enabled")
else
Util:Print("Disabled")
end
end
function Util:GetPrintMode()
return PrintEnabled
end
local DebugMode = false
function Util:ToggleDebug()
DebugMode = not DebugMode
if DebugMode then
Util:Print("Debug mode enabled")
else
Util:Print("Debug mode disabled")
end
end
function Util:GetDebugMode()
return DebugMode
end
function Util:Debug(...)
if not DebugMode then
return
end
local args = { ... }
local str = "|cFFDF6520[Bastion]|r |cFFFFFFFF"
for i = 1, #args do
str = str .. tostring(args[i]) .. " "
end
print(str)
end
Bastion.Util = Util