You're trying to use an if
formatted:
if p.x, p.y == 64, 45 then
[...]
end
You can assign values to multiple variables with syntax a little like what you've used here. For example,
p.x, p.y = 64,45
would set p.x
to 64
and p.y
to 45
. But you can't check for equality on multiple variables in that way. You need to check each variable separately:
if p.x == 64 and p.y == 45 then
[...]
end
Your code tries to use p.x, p.y == 64, 45
as a condition for your if
branch. This doesn't work because lua doesn't understand this to mean p.x == 64 and p.y == 45
. Instead it understands it as a list of unrelated statements (p.x
, p.y == 64
, and 45
), and trips up on the comma between p.x
and p.y
.