mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-27 06:10:49 +00:00
stable: capture per-iteration button in Enable/Disable closures
Lua 5.0 shares the generic-for loop variable across iterations, so the closures all saw the final (nil) value.
This commit is contained in:
@@ -35,13 +35,14 @@ pfUI:RegisterSkin("Pet Stable Master", function ()
|
|||||||
StripTextures(button)
|
StripTextures(button)
|
||||||
SkinButton(button, nil, nil, nil, _G[button:GetName().."IconTexture"])
|
SkinButton(button, nil, nil, nil, _G[button:GetName().."IconTexture"])
|
||||||
|
|
||||||
button.Enable = function()
|
local b = button
|
||||||
button:SetBackdropColor()
|
b.Enable = function()
|
||||||
button.locked = false
|
b:SetBackdropColor()
|
||||||
|
b.locked = false
|
||||||
end
|
end
|
||||||
button.Disable = function()
|
b.Disable = function()
|
||||||
button:SetBackdropColor(1, .1, .1, .3)
|
b:SetBackdropColor(1, .1, .1, .3)
|
||||||
button.locked = true
|
b.locked = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user