question regarding tables and number of entries
Im looking for a way to determine the number of entries on the fly for a chat multiiple event filter im working on for the "FOR" statement. Ive been getting errors stating its expecting a number with this setup.
Code:
MyAddon.killFilterList = {} then later clear the list which I think I can do with "MyAddon.killFilterList = {}" but untested untill the 1st part is working. Suggestions? |
can you explain with a small simple example what you want to do.
maybe it is just me, but i have no idea what you are trying to achieve with the text you posted. |
Quote:
|
Quote:
|
You need to iterate the table, but it depends on the structure of your table. You need to use either
Lua Code:
Lua Code:
e.g. Lua Code:
instead of ipairs you could also use: Lua Code:
|
Quote:
Other than you are mixing two different approaches on how to use tables and end up not filtering anything at all. You iterate over the table and insert new entries into it with numeric indexes, but at the same time try to access entries in the table by using the displayName as a key (instead of the numeric index). Code:
MyAddon.killFilterList = {} |
Quote:
what im trying to do is add victoms to the list and NOT display them(and return false) if in the list because the ingame killfeed fires twice per kill. will "#MyAddon.killFilterList" work in the for .. do statement for length of list or number of entries? I've never seen this example before. The devs posted a fix for the pvp kill feed double spam but I cant find it anywhere.. Anyone have a link? |
Quote:
# means "count of" and only works (afaik) with non-gap index tables, same as "for key, value in ipairs(tableName) do " would iterate. If your key is a string like a characteror accountName, it will not work. You will have to read above then where the guys explainend you alreay how to iterate that -> "in pairs" (not in ipairs) |
Quote:
|
Quote:
|
Quote:
https://www.esoui.com/forums/showthr...8153#post48153 the event sends these variables twice when firing: Code:
(eventCode, killLocation, killerDisplayName, killerCharacterName, killerAlliance, killerRank, victomDisplayName, victomCharacterName, victomAlliance, victomRank, isKillLocation) |
All times are GMT -6. The time now is 05:04 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI