Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 

WoWInterface » Developer Discussions » Lua/XML Help » Problems with Big Tables


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off