diff Veneer.lua @ 79:0784b87f9722

- adjust top anchors for OrderHallCommandBar
author Nenue
date Sun, 11 Sep 2016 18:46:30 -0400
parents 83b3cdaae6a5
children bb6b532c5d2f
line wrap: on
line diff
--- a/Veneer.lua	Tue Aug 30 03:32:22 2016 -0400
+++ b/Veneer.lua	Sun Sep 11 18:46:30 2016 -0400
@@ -17,13 +17,22 @@
 local configMode
 local veneers = {}
 
-do
-  local anonID = 0
-  local AnonymousName = function()
+local anonID = 0
+
+local tostring = tostring
+local IsFrameHandle = IsFrameHandle
+local GetAnonymousName = function(key)
+  if not key then
     anonID = anonID + 1
-    return 'VN' .. anonID
+    key = anonID
   end
+  return 'VN' .. key
 end
+local GetTableName = function(table)
+  return (IsFrameHandle(table) and table:GetName()) or tostring(table)
+end
+
+
 
 local anchor_coefficients = {
   ['TOP'] = function(x, y) return x, y end,
@@ -135,12 +144,11 @@
     return
   end
 
-
   if veneers[frame] then
     return veneers[frame]
   end
 
-  local name = (frame:GetName() or AnonymousName())..'Veneer'
+  local name = type(frame) == 'table' and GetTableName(frame) or GetAnonymousName()
   local veneer = CreateFrame('Frame', name, frame, template or 'VeneerTemplate')
   print('+veneer', name)