Originally Posted by arkemiffo
... it's just that the counter in the handler doesn't seem to be saved by iteration in each instance of the button creation, but all of the buttons hold the number 12 (which is the last iteration of the var counter). ...
|
It's because function in OnMouseDown is called within a closure (
read here). You must do it that way:
Code:
local c = counter
EffectButtonControl:SetHandler("OnMouseDown", function(self) NotebookOnChange(c) end)