Add stylua toml
This commit is contained in:
40
Cyka.lua
40
Cyka.lua
@@ -43,21 +43,13 @@ local addonname, shared = ...
|
||||
---@field everything { enabled: boolean }
|
||||
|
||||
local function init()
|
||||
if not CykaPersistentData then
|
||||
CykaPersistentData = {}
|
||||
end
|
||||
if not CykaPersistentData.config then
|
||||
CykaPersistentData.config = {}
|
||||
end
|
||||
if not CykaPersistentData then CykaPersistentData = {} end
|
||||
if not CykaPersistentData.config then CykaPersistentData.config = {} end
|
||||
|
||||
shared.GetOrDefault = function(table, keys, default)
|
||||
local value = default
|
||||
if not table then
|
||||
return value
|
||||
end
|
||||
if not keys then
|
||||
return value
|
||||
end
|
||||
if not table then return value end
|
||||
if not keys then return value end
|
||||
|
||||
local traverse = table
|
||||
for i = 1, #keys do
|
||||
@@ -68,9 +60,7 @@ local function init()
|
||||
break
|
||||
end
|
||||
|
||||
if i == #keys then
|
||||
value = traverse
|
||||
end
|
||||
if i == #keys then value = traverse end
|
||||
end
|
||||
return value
|
||||
end
|
||||
@@ -82,9 +72,7 @@ local function init()
|
||||
print(tostring(table))
|
||||
return
|
||||
end
|
||||
if depth == nil then
|
||||
depth = 0
|
||||
end
|
||||
if depth == nil then depth = 0 end
|
||||
if depth > 200 then
|
||||
print("Error: Depth > 200 in dumpTable()")
|
||||
return
|
||||
@@ -103,9 +91,7 @@ local function init()
|
||||
---@param value any
|
||||
shared.TableContains = function(table, value)
|
||||
for _, v in pairs(table) do
|
||||
if v == value then
|
||||
return true
|
||||
end
|
||||
if v == value then return true end
|
||||
end
|
||||
return false
|
||||
end
|
||||
@@ -293,9 +279,7 @@ local loaded = 0
|
||||
local loadedFrame = CreateFrame("Frame")
|
||||
loadedFrame:RegisterEvent("ADDON_LOADED")
|
||||
loadedFrame:SetScript("OnEvent", function(self, event, addonName)
|
||||
if addonName == addonname then
|
||||
init()
|
||||
end
|
||||
if addonName == addonname then init() end
|
||||
end)
|
||||
|
||||
local ticker
|
||||
@@ -303,13 +287,9 @@ ticker = C_Timer.NewTicker(1, function()
|
||||
-- IT JUST WONT FUCKING RUN JUST FUCKING RUN THE FUCKING FUNCTION GOD DAMN IT
|
||||
loaded = loaded + 1
|
||||
init()
|
||||
if loaded > 100 then
|
||||
ticker:Cancel()
|
||||
end
|
||||
if loaded > 100 then ticker:Cancel() end
|
||||
end)
|
||||
|
||||
local logoutFrame = CreateFrame("Frame")
|
||||
logoutFrame:RegisterEvent("PLAYER_LOGOUT")
|
||||
logoutFrame:SetScript("OnEvent", function(self, event, ...)
|
||||
CykaPersistentData.config = shared.config
|
||||
end)
|
||||
logoutFrame:SetScript("OnEvent", function(self, event, ...) CykaPersistentData.config = shared.config end)
|
||||
|
||||
Reference in New Issue
Block a user