View Single Post
08-13-15, 07:51 AM   #1
Endzeit
A Deviate Faerie Dragon
Join Date: Aug 2015
Posts: 12
Problems with Big Tables

Edit#2:
It works now.. but i got stutter when hover over items.. is there a way with a ~1800 table to improve performance?
-----
EDIT:
i found the problem.. this is working:
Code:
local setName =  {
[1] = {  name = "Mystic's Regalia (Recolor)", items = {14090, 26008, 14094}, },
-- [2......1778]
[1779] = {  name = "Imperial Plate", items = {31436, 30002, 12424, 12425, 12422, 12427, 12429}, },
}
function addline_gametip()
local itemName,itemLink = GameTooltip:GetItem()
	if itemLink ~= nil then	   
		local itemString = string.match(itemLink, "item[%-?%d:]+");
		local _, itemId, enchantId, jewelId1, jewelId2, jewelId3, jewelId4, suffixId, uniqueId, linkLevel, reforgeId = strsplit(":", itemString);

 for i = 1, #setName do
j = 1 
while j <= 8 do

if (setName[i]['items'][j] ~= nil) and (format("%u",itemId) == format("%u", setName[i]['items'][j])) then
 		GameTooltip:AddLine("Transmog Set: " .. setName[i]['name'])
 		GameTooltip:Show();
 		end
j = j + 1
		end
 end
 end
 end

 

GameTooltip:HookScript("OnTooltipSetItem", addline_gametip);
-------

I'm working on my first wow addon and i'm a big newbie with lua and coding. I think im finished, but it dont work.

problems are the do while i think. here is my code:

Code:
local setName =  {
[1] = {  name = "Mystic's Regalia (Recolor)", items = {14090, 26008, 14094}, },
-- [2......1778]
[1779] = {  name = "Imperial Plate", items = {31436, 30002, 12424, 12425, 12422, 12427, 12429}, },
}

function addline_gametip()
local itemName,itemLink = GameTooltip:GetItem()
	if itemLink ~= nil then	   
		local itemString = string.match(itemLink, "item[%-?%d:]+");
		local _, itemId, enchantId, jewelId1, jewelId2, jewelId3, jewelId4, suffixId, uniqueId, linkLevel, reforgeId = strsplit(":", itemString);

 for i = 1, #setName do
j = 1 
while j <= 8 do
 if (itemId == setName[i]['items'][j]) then
 		GameTooltip:AddLine("Transmog Set: " .. setName[i]['name'])
 		GameTooltip:Show();
 		end
j = j + 1
		end
 end
 end
 end


GameTooltip:HookScript("OnTooltipSetItem", addline_gametip);
hope someone can help me

Last edited by Endzeit : 08-13-15 at 10:32 AM.
  Reply With Quote