View Single Post
Old 06-30-2019, 07:30 PM   #509
Human being with feelings
woodslanding's Avatar
Join Date: Mar 2007
Location: Denver, CO
Posts: 391
Default argument in control method override

I'm trying to create a matrix of buttons, and I'm trying to get each one to call a master method (called 'select') with its own index as an argument:

for i = 1,buttonCount

    --create button, etc

    ctl.onmouseup = function(self) select(i) GUI.IButton.onmouseup(self) end
and it doesn't seem to work. I feel like I don't quite understand what happens when you create this kind of function... does the value of 'i' not get stored with the function?
eric moon
Very Stable Genius
woodslanding is offline   Reply With Quote