diff SkeletonKey/SkeletonKey.lua @ 50:1aba8a6fd4a9

- fix kb.bindings content and define a generic function for constructing its keystrings - handle hotkey text for actions placed in multiple slots -- hotkey.actionbar generates a cache table for use during binding changes
author Nenue
date Fri, 19 Aug 2016 01:12:56 -0400
parents 73df13211b22
children 81a7c71c4483
line wrap: on
line diff
--- a/SkeletonKey/SkeletonKey.lua	Thu Aug 18 01:34:22 2016 -0400
+++ b/SkeletonKey/SkeletonKey.lua	Fri Aug 19 01:12:56 2016 -0400
@@ -72,11 +72,11 @@
 
 
 local db
-local bindHeader, currentHeader = '', ''
-local specID, specGlobalID, specName, specDesc, specTexture, characterHeader = 0, 0, 'SPEC_NAME', 'SPEC_DESCRIPTION', 'Interface\\ICONS\\INV_Misc_QuestionMark', 'PLAYER_NAME'
+local _G = _G
+local UnitName, SelectedRealmName, InCombatLockdown, UnitClass = UnitName, SelectedRealmName, InCombatLockdown, UnitClass
+local tostring, select, tinsert, pairs = tostring, select, tinsert, pairs
+local concat, wipe = table.concat, table.wipe
 local classHeader, className, classID = '', '', 0
-local bindsCommitted = true
-local forceButtonUpdate = false
 
 --- Control handles
 local saveButton, restoreButton, clearButton
@@ -139,7 +139,7 @@
   end
 
   if #stack >= 1 then
-    return table.concat(stack, ',')
+    return concat(stack, ',')
   else
     return nil
   end
@@ -197,11 +197,11 @@
 
 kb.ResetProfile = function(profile, prototype)
   if profile == kb.currentProfile then
-    for i, button in pairs(buttons) do
+    for i, button in pairs(kb.buttons) do
       kb.ReleaseSlot(button)
     end
   end
-  table.wipe(profile)
+  wipe(profile)
   kb.InitProfile(profile, prototype)
 end
 
@@ -284,13 +284,10 @@
   kb.ui()
 end
 
-
-
-
 --- post ADDON_LOADED
 kb.variables = function()
-  SkeletonKeyDB = kb.InitProfile(SkeletonKeyDB, {})
-  kb.db = SkeletonKeyDB
+  _G.SkeletonKeyDB = kb.InitProfile(_G.SkeletonKeyDB, {})
+  kb.db = _G.SkeletonKeyDB
   kb.playerName = UnitName('player')
   kb.playerRealm = SelectedRealmName()
   kb.profileName = kb.playerRealm .. '_' .. kb.playerName
@@ -322,6 +319,7 @@
 end
 
 -- Volatiles Access
+kb.FormatActionID = function(actionType, actionID) return tostring(actionType) .. '_' .. tostring(actionID) end
 kb.GetBindings = function() return kb.bindings end
 kb.GetButtons = function() return kb.buttons end
 kb.GetCharacterProfile = function () return kb.loadedProfiles[BINDING_TYPE_CHARACTER] end