Lua Relational Operators Not Working, Scripting in Rainmeter

88 Views Asked by At

Im writing a script for a Rainmeter. The script's function Update doesn't run whenever the < or > operator is called, or when the variable is used in the max or min math functions.

For example, this code: SpinSpeed = math.max(1,1)

runs fine.

However, when I do this: SpinSpeed = math.max(SpinSpeed,1)

None of the code in the function seems to run at all, which I tested separately.

Additionally, this code gives me the same problem: if (SpinSpeed > BaseSpinSpeed) then

Does anyone have any idea why this is occurring? Thank you for your time.

Code:

function Initalize ()
    BaseSpinSpeed = 1
    SpinSpeed = BaseSpinSpeed
    SpinSpeedMax = 5
    SpinAccel = 1
    Accelerating = false
end

function Update ()
    if (Accelerating == true)
    then
        if (SpinSpeed < SpinSpeedMax) then
            SpinSpeed = math.min(SpinSpeed+SpinAccel, SpinSpeedMax)
        end
    else
        if (SpinSpeed > BaseSpinSpeed)
        then
            SpinSpeed = math.max(SpinSpeed-SpinAccel, BaseSpinSpeed)
        end
    end

    -- Set Spin Speed
    SKIN:Bang('!SetVariable', 'SpinSpeed', tostring(SpinSpeed))
end

function MouseOver ()
    Accelerating = true
end

function MouseOff ()
   Accelerating = false
end
0

There are 0 best solutions below