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 = { 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 = { |
cannot help on technical side and i am not sure if i get, what you trying to do :)
but what if you do table other way around and index by itemID with aray of sets name that item is in adding tooltip then would be trivial |
lua has no problem with very large tables, just make an itemid to setid lookup table.
Lua Code:
|
wow this works great. thanks :)
Next Step i want to add Message, when one of this Items received Loot. Lua Code:
this is not working.. whats the different between GetItemInfo(itemID); and GameTooltip:GetItem(); ? Can i use the same lookup table or i need a new one? Can i use the same locals agains? |
Quote:
I believe they want to have the tooltip show every set that contains a particular itemID not just the first one that returns true. Lua Code:
|
thanks suicidalkatt & elcius.
Quote:
Lua Code:
thats my code for chat_msg_loot so far.. in my first tests it works.. have someone also an improvement for this code? |
Since all the code is doing is matching items to set names, the lookup table doesn't need to be so complicated to use. Here's my example. There can be more optimizations depending on how you want the tooltip to look.
Lua Code:
Edit: Replaced string.join() section with more efficient table.concat() call. |
Lua Code:
works.. but it also show loot from other player.. this should not happen. i tried this: Lua Code:
|
try
Lua Code:
|
Quote:
also trying change from 'function(self,event,msg,who...)' to 'function(self,event,msg,who,...)' and ' if who==UnitName("player")' to ' if who==UnitName("player") then' no lua errors now, but is not working anymore print(who); returns nothing like print(); |
obviously i cannot drycode :)
its 5th argument, from fast /etrace Lua Code:
|
this cannot be working like this
for example playername: "Killer" target returns "Killer" UnitName("player") returns "Killer nil" Lua Code:
this works for UnitName("player"), cant check now if it works for other players |
instead of UnitName("player") use select(1, UnitName("player"))
or make a variable local playername=UnitName("player") |
Quote:
|
There's also the option of
Code:
(UnitName("player")) |
Quote:
|
ok ok, select is big nono, i get it :)
dont wanna hijack topic, but not even here instead of sexy and nice Lua Code:
would be better hideous abomination with numerous if depends of numbonuses and 14+ _ ? |
Quote:
|
Quote:
|
Quote:
Edit: Without wanting to make a point of it, just did some quick benchmarks so people can get an idea of the difference. This takes 43 ms to run: Code:
for i = 1, 1e6 do Code:
for i = 1, 1e6 do |
All times are GMT -6. The time now is 04:37 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI