PDA

View Full Version : Lua String comparison


arthina
18-07-2007, 08:04 PM
Hi! I am trying to program my first Addon. I am using this Macro ingame:

/script SendChatMessage(TestFunction("%t"), "SAY")

to try some stuff out. I want to say "Arthina is a very nice friend to have" if I am targeted and "Sad moments." if not.
However, this script just won't work:

function TestFunction(m)
if not (string.find("Arthina", m) == nil) then
return "Arthina is a very nice friend to have.";
end

return "Sad moments.";
end;

Any1 knows what I am making wrong?

Thanks for the help already :)

Arthina :afro:

/edit: NVM

function TestFunction(m)
local Abc = UnitName("target");
if ("Arthina" == Abc) then
return "Arthina is a very nice friend to have.";
-- else
-- Arthinastore = "Sad moments.";
end