LUA error in 10.0.0 - Bad Argument #1 to SetAlpha #124


Open
  • LFGKilikk created this issue Oct 31, 2022

    Looks like alpha resolved to > 1 in this scenario and as of 10.0.0 they're not auto-clamping into the 0-1 range anymore.

     

    Patch 10.0.0 (2022-10-25): Now throws an error when the alpha argument is outside the [0, 1] range.

     

    929x Interface/AddOns/Omen/Omen.lua:985: bad argument #1 to 'SetAlpha' (Usage: self:SetAlpha(alpha))
    [string "=[C]"]: in function `SetAlpha'
    [string "@Interface/AddOns/Omen/Omen.lua"]:985: in function <Interface/AddOns/Omen/Omen.lua:978>

    Locals:
    (*temporary) = OmenFlashFrame {
    0 = <userdata>
    elapsed = 0.744000
    texture = Texture {
    }
    }
    (*temporary) = -0.003333

  • Silarn posted a comment Nov 9, 2022

    Reposting from the original 10.0.0 issue...

     

    I was able to fix this by updating the function at 975 with the following:

     

    		flasher:SetScript("OnUpdate", function(self, elapsed)
    			local totalElapsed = self.elapsed + elapsed
    			if totalElapsed < 2.6 then
    				local alpha = totalElapsed % 1.3
    				if alpha < 0.15 then
    					self:SetAlpha(math.min(alpha / 0.15, 1))
    				elseif alpha < 0.9 then
    					self:SetAlpha(math.max(1 - (alpha - 0.15) / 0.6, 0))
    				else
    					self:SetAlpha(0)
    				end
    			else
    				self:Hide()
    			end
    			self.elapsed = totalElapsed
    		end)
  • Silarn posted a comment Nov 9, 2022

    There also seemed to be an issue with using "local elapsed" where it wasn't actually increasing the self.elapsed property properly. Changing the var name to not conflict with the callback parameter name seemed to correct this issue.


To post a comment, please login or register a new account.