View Single Post
Old 05-21-2019, 06:32 AM   #481
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,240
Default

Quote:
Originally Posted by woodslanding View Post
Wow, this is just rockin along!!

question: I want to create a bunch of similar items that each address a different track... I can create unique names for them by concatenating a string, but then I don't know how to access them.
- Accessing array elements with variables is just a matter of using []s and concatenating a string the same way.

- You can use self inside any method that will be called with the : syntax.

Code:
for i = 0, 10 do
  local ctl = GUI.elms["ns_ctl"..i]
  ctl.onmouseup = function(self)
    setNoteSource(self.trk, self:val())
    GUI.IControl.onmouseup(self)
  end
end
Lokasenna is online now   Reply With Quote