Use what SDPhantom said to dissuade everyone.
Personally I'd use more tables than concatenations since memory references take both CPU cycles and RAM, it can actually take less time just to use an extra CPU cycle.
Lua Code:
PBA.APBUseBlizz[BarID] -- two simple table lookups
--instead of PBA['APBUseBlizz' .. BarID] -- You create two strings in RAM, access both, and do a table lookup
Scope helps, creating new locals every single time in a loop creates them that many times. And garbage collection isn't guaranteed to work immediately after the function is resolved.
Lua Code:
local AltPowerType, MinPower, PowerName, PowerTooltip, ZoneName, _ -- _ is still a variable and is a common global leak in addons
for BarID = 1, 10000 do
AltPowerType, MinPower, _, _, _, _, _, _, _, _, PowerName, PowerTooltip = GetAlternatePowerInfoByID(BarID)
ZoneName = APBUsed[BarID]
Making If statements with a common denominator helps
Lua Code:
local Index
--scoping mentioned above
if AltPowerType then
if TableName ~= 'APB' and APBUseBlizz[BarID] then
Index = APBUseBlizz[BarID]
else
PBA.APBUseBlizz[BarID] = {}
end
end