I never really thought about how taxing getglobal was. Would it be faster to put all the globals you are going to scan in a table that would be built within an OnLoad function?
I was thinking more of another addon I have written and it calls getglobal 30 times OnUpdate. Would it be faster to define all 30 of those to a table and simply retrieve 30 table values?
While we are talking about efficiency I was wondering if it was faster to run a check or a simple function. Mainly I was wondering about the Show() and Hide() functions. To keep a frame hidden would it be faster to check IsVisible() or to simply Hide() it regardless?
For personal use this would work fine. But to actually publish this mod you would need a table with a listing of every mount in the game which would be quite large. The alternative is to scan the tooltips of each inventory item instead of just the name.
You would simply need to translate a single line for each language (2 if you also want the AQ mounts)
function SlotIsMount(bag, slot)
for i = 1, 30 do
text = getglobal("GameTooltipTextLeft" .. i):GetText()
if text and string.find(text, "Use: Summons and dismisses a rideable ") then
elseif text and string.find(text, "Use: Emits a high frequency sound, forcing a silithid tank") then