From a6d570c5536593961a976ae880b313a4e521806a Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Sat, 4 Jan 2025 13:57:41 +0100 Subject: [PATCH] Fix some other bullshit, make work --- Actions.lua | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/Actions.lua b/Actions.lua index 9c7a87d..d63ceaf 100644 --- a/Actions.lua +++ b/Actions.lua @@ -23,7 +23,6 @@ local pickupActionButton = { } local function RestoreActionButton(self, index, actionButton) - -- Clear the slot if GetActionInfo(index) then PickupAction(index) ClearCursor() @@ -34,9 +33,9 @@ local function RestoreActionButton(self, index, actionButton) end local aliases = ActionBarSaverReloaded.spellAliases[actionButton.id] or {} - local ids = Array.insert(aliases, actionButton.id, 1) + table.insert(aliases, actionButton.id) - for _, id in ipairs(ids) do + for _, id in ipairs(aliases) do pickupActionButton[actionButton.type](id) if GetCursorInfo() == actionButton.type then @@ -80,7 +79,6 @@ local function AddWarning(warnings, macroName, usages) end function SaveSet(setName) - print("ABS SaveSet") if not setName or setName == "" then print("Set name cannot be empty") return @@ -111,9 +109,9 @@ function SaveSet(setName) ActionBarSaverReloaded.sets[setName] = set print(string.format("Saved set '%s'!", setName)) - Array.iter(warnings, function(warning) + for _, warning in ipairs(warnings) do print(warning) - end) + end end function RestoreSet(setName) @@ -158,9 +156,9 @@ function RestoreSet(setName) end print(string.format("Restored set '%s'", setName)) - Array.iter(messages, function(warning) + for _, warning in ipairs(messages) do print(warning) - end) + end end function DeleteSet(setName) @@ -180,7 +178,10 @@ function DeleteSet(setName) end function ListSets() - local sets = Dict.keysAsArray(ActionBarSaverReloaded.sets) + local sets = {} + for setName, _ in pairs(ActionBarSaverReloaded.sets) do + table.insert(sets, setName) + end table.sort(sets) local setsStr = table.concat(sets, ", ") @@ -204,11 +205,15 @@ function AliasSpell(args) local aliases = ActionBarSaverReloaded.spellAliases[spellID] or {} - if Array.contains(aliases, aliasID) then - print(string.format("Spell %d is already aliased by %d", spellID, aliasID)) - return + for _, id in ipairs(aliases) do + if id == aliasID then + print(string.format("Spell %d is already aliased by %d", spellID, aliasID)) + return + end end + table.insert(aliases, aliasID) + table.insert(aliases, aliasID) ActionBarSaverReloaded.spellAliases[spellID] = aliases @@ -258,10 +263,8 @@ function PrintUsage() end SlashCmdList["ABS"] = function(argv) - print("ABS slash", tostring(argv)) - local args = strsplit(" ", argv) + local args = {strsplit(" ", argv)} local cmd = args[1] - print("ABS slash", tostring(cmd)) if cmd == "save" then SaveSet(args[2])