I am not an expert programmer. I just started really learning recently. I am going crazy trying to code what should be something simple, but I can't get it to work. I started trying to understand tables and I got this to work, but as soon as I introduce any MQ TLO code it fails.
[CODE lang="Lua" title="working function"]local tank_list = {
my_tank = "tank"
}
local function is_tank(table, key)
if table[key] ~= nil then
return true
else
return false
end
end
-- this returns true if I give it the name of my tank and false otherwise as expected
print(is_tank(tank_list, "my_tank"))[/CODE]
[CODE lang="Lua" title="failing function"]local tank_list = {
my_tank == "tank" -- I replace my_tank with the name of my tank I just use variable here so I don't show my character name
}
local function is_tank(table,key)
if table[key] ~= nil then
return true
else
return false
end
end
local tank_key = mq.TLO.Target.AggroHolder --this seems to return a string so should work?
print(is_tank(tank_list, tank_key)) -- it always returns false but it works if I ddon't use any MQ TLO
[/CODE]
Is there a better way to do this? I just want to see if the current mob is targeting my tank and if its not I want him to taunt. I feel like this should be very simple, but its wasted my whole day trying to figure it out.
[CODE lang="Lua" title="working function"]local tank_list = {
my_tank = "tank"
}
local function is_tank(table, key)
if table[key] ~= nil then
return true
else
return false
end
end
-- this returns true if I give it the name of my tank and false otherwise as expected
print(is_tank(tank_list, "my_tank"))[/CODE]
[CODE lang="Lua" title="failing function"]local tank_list = {
my_tank == "tank" -- I replace my_tank with the name of my tank I just use variable here so I don't show my character name
}
local function is_tank(table,key)
if table[key] ~= nil then
return true
else
return false
end
end
local tank_key = mq.TLO.Target.AggroHolder --this seems to return a string so should work?
print(is_tank(tank_list, tank_key)) -- it always returns false but it works if I ddon't use any MQ TLO
[/CODE]
Is there a better way to do this? I just want to see if the current mob is targeting my tank and if its not I want him to taunt. I feel like this should be very simple, but its wasted my whole day trying to figure it out.


