Sinjuku
Sinjuku

Reputation: 1

Inexplicable syntax error in Lua for logitech gaming software

I've being trying this language and i keep getting random syntax errors and i cant figure out why, this is a simple recoil script. It keeps telling me i have a syntax error on line 39, everything is green so i can still try it out while i try to fix. I can post the rest of the code if someone needs.

Code:

function recoil_values()
    if gun_mode = "gun1" then
        if round = "attack" then
            --Ash R4C-- 
            x_recoil = -1
            y_recoil = 4
            sleep_value = 10
        else
            --Twitch F2--
            x_recoil = -10
            y_recoil = 0
            sleep_value = 10            
        end
    else
        if round = "attack" then
            --Jager 41C--   
            x_recoil = 10
            y_recoil = 0
            sleep_value = 10
        else
            --Bandit MP7--
            x_recoil = 0
            y_recoil = 10
            sleep_value = 10    
        end
    end
end

Upvotes: 0

Views: 231

Answers (1)

luther
luther

Reputation: 5554

Your if statements contain =, which is used for assignment. Lua does not allow assignments between if and then.

If you want to compare two values for equality, use ==.

Upvotes: 1

Related Questions