function checkMobsInRoom() local targName = "" for k, v in pairs(bashingTable) do if table.contains(mobsInRoom, v) and target:title() ~= k:title() and autoBashing() then target(k) return elseif type(bashingTable[k]) == "table" then targName = k for _, v in pairs(bashingTable[k]) do if table.contains(mobsInRoom, v) and target:title() ~= targName:title() and autoBashing() then target(targName) return end end end end end function bash() if bal() and autoBashing == "true" then send("qjab "..target) end endSo I have that. Don't be fooled by "autoBashing", it's just what I call it. I'm a trying to pull from the following table (it is very small, just testing things right now before I start populating the table more with different areas and such) so that if the mob is in the room, it will switch targets to the appropriate alias.
bashingTable = { horde = "an orcish grunt", "an orcish mage", }Thanks in advance for any and all assistance! This is my very first time working with functions and tables, so I feel super lost and overwhelmed.
Comments
The horde entry should also be a table, as how you had it written would just set horde to the first string ("an orcish grunt") and ignore anything supplied after it.
As for the loops, I rearranged them a bit based on what you have there. You are not setting targName in what you posted, so that might be part of the issue.
I believe you could also just not the type==table check and use a single loop, though it may require some modification on how you set up the bashingTable.