PDA

View Full Version : [Help Please] Using Variables?



Eion
02-24-2013, 09:35 AM
Lets say I want to compare an Items ID too a list of Item IDs. Then I want to compare them and do something if they are equal. I set it up like the following example, it does not compare correctly with multiple values for one variable although it will work if you just use one value such as "local id = 2523". What am I doing wrong?




local id = {2523,2524}

if Map.GetTopMoveItem(x,y,z).id == id then
DOSOMETHING
end



Edit: I fixed my own problem.





local id = {2523,2524}
for _, id in ipairs(id) do
if Map.GetTopMoveItem(x,y,z).id == id then
DOSOMETHING
end
end