From 72f26892d0b0d943292d4574222ebdceabfdd914 Mon Sep 17 00:00:00 2001 From: John Pasula Date: Tue, 25 Jan 2011 09:15:34 -0700 Subject: [PATCH] Butcher the strsplit code to work with first aid, and to pass a third argument if that's what we get. --- core.lua | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/core.lua b/core.lua index 99b203d..849050a 100644 --- a/core.lua +++ b/core.lua @@ -1488,7 +1488,7 @@ function addon:InitializeProfession(profession) end do - -- Code snippet stolen from GearGuage by Torhal + -- Code snippet stolen from GearGuage by Torhal and butchered by Ackis local function StrSplit(input) if not input then return nil, nil end local arg1, arg2, var1 @@ -1497,17 +1497,23 @@ do arg1 = (arg1 and arg1:lower() or input:lower()) if var1 then - local var2 - arg2, var2 = var1:match("^([^%s]+)%s*(.*)$") - arg2 = (arg2 and arg2:lower() or var1:lower()) + -- Small hack to get code to work with first aid. + local fa = L["First Aid"] + if var2:lower() == fa:lower() then + arg2 = var2 + else + local var2 + arg2, var2 = var1:match("^([^%s]+)%s*(.*)$") + arg2 = (arg2 and arg2:lower() or var1:lower()) + end end - return arg1, arg2 + return arg1, arg2, var2 end -- Determines what to do when the slash command is called. function addon:ChatCommand(input) - local arg1, arg2 = StrSplit(input) + local arg1, arg2, arg3 = StrSplit(input) -- Open About panel if there's no parameters or if we do /arl about if not arg1 or (arg1 and arg1:trim() == "") or arg1 == strlower(L["Sorting"]) or arg1 == strlower(L["Sort"]) or arg1 == strlower(_G.DISPLAY) then -- 1.7.9.5