Faedara said:
Alright, so I want to match a list displayed like this:
Thaipan, Troel, Arabi, Arakh, Otha, Diavolo, Solymr, Dessa, Santar, Hrekka, Lothenshal, Pilts, Jarik, Mortikai, Vand, Daje,
To compare to a list like this:
Runia, Xae, Lothenshal, Troel, Iocun, Izak, Mina, Naeth, Nephenee, Orklanishkal, Suriyah, Brahmsul, Ashadra, Jackel, Madelyne, Gigvanehldi, Runa, Mortikai, Sheltan, Lacertix,
However...
I'm having trouble figuring out how to pull the names from the first list and make them into a table that highlights matches in the second list...
Okay, so lets say we have a trigger for this. In the Send box, lets split the list by ", " so we have a Lua table containing the names.
local name_array = utils.split("%1", ", ")
However, this makes a table like {[1] = "Runia", [2] = "Xae"}, which makes it very annoying and somewhat difficult to compare to another list. So lets use the names as keys instead of values (i.e. {["Runia"] = true, ["Xae"] = true}. How do we do that? Like this:
local name_array = utils.split("%1", ", ")
local name_set = {}
for k,v in ipairs(name_array) do
name_set[v] = true
end
Now you can do something like this to see if a name is in the set:
if name_set["Xae"] then
Note("Xae is online")
end
I hope that helps. If there's anything I missed just let me know. |