Log In  

in my code I have a variable named "times" and I am trying to add one to that variable
I do so with:

times+=1

however it throws this strange error

syntax error line 12 (tab 2)
times+=1
')' expected near '='

my whole code is this:

function move_x(x,obj,flag)
    local times=0
    local my_x=obj.x
    repeat
        my_x+=x/abs(x)
     if (collide(obj,flag))
     then
        times=abs(x)-1
     end
     times+=1
    until (times = abs(x))
end

plz help!

P#98286 2021-10-06 16:22

1

It's just the "until" line. You're using assignment (=) where you meant equality (==)

P#98287 2021-10-06 16:28 ( Edited 2021-10-06 16:29)

thanks!

P#98291 2021-10-06 17:18

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-29 02:05:30 | 0.006s | Q:13