-
Hello, |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 13 replies
-
I think you have two choices:
|
Beta Was this translation helpful? Give feedback.
-
Once you get the idea of metatables, you will never look back! Using Your table = t However if you create another table
or, you can assign the metatable directly to the calling table:
or
For example, in your DPS-V77 panel you have nearly 400 initializers for controls: MixFad6 = panel:getModulatorByName("MixFad6") MixFad7 = panel:getModulatorByName("MixFad7") MixFad8 = panel:getModulatorByName("MixFad8") MixFad9 = panel:getModulatorByName("MixFad9") MixFad10 = panel:getModulatorByName("MixFad10") MixFad11 = panel:getModulatorByName("MixFad11") MixStructCombo = panel:getModulatorByName("MixStructCombo") EqAtypeCombo = panel:getModulatorByName("EqAtypeCombo") EqBtypeCombo = panel:getModulatorByName("EqBtypeCombo") FxAdisplay = panel:getModulatorByName("FxAdisplay") FxBdisplay = panel:getModulatorByName("FxBdisplay") .... You can replace all that with these 4 lines of code in
In your panel now, instead of calling
you call:
but the great thing is if you want to create a new control, you don't have to do anything:
will work without having to initialise a new variable in Another use is the infamous lua tables start at index 1 not 0 like in other panels: There are two possibilities here:
outputs [1] "my first item = 1" [2] "My next item = 2" [3] "My next item = 3" [4] "My next item = 4" [5] "My next item = 5" [6] "My next item = 6" [7] "My next item = 7" [8] "My next item = 8" [9] "My next item = 9" [10] "My next item = 10" [11] "My next item = 11" [12] "My next item = 12" [13] "My next item = 13" [14] "My next item = 14" [15] "My next item = 15" [16] "My next item = 16" [17] "My next item = 17" [18] "My next item = 18" [19] "My next item = 19" [20] "My next item = 20" [21] "My next item = 21" [22] "My next item = 22" [23] "My next item = 23" [24] "My next item = 24" [25] "My next item = 25" [26] "My next item = 26" [27] "My next item = 27" [28] "My next item = 28" [29] "My next item = 29" [30] "My next item = 30" [31] "My next item = 31" [32] "My next item = 32" or as an alternative:
will print [1] "My item = 1" [2] "My item = 2" [3] "My item = 3" [4] "My item = 4" [5] "My item = 5" [6] "My item = 6" [7] "My item = 7" [8] "My item = 8" [9] "My item = 9" [10] "My item = 10" [11] "My item = 11" [12] "My item = 12" [13] "My item = 13" [14] "My item = 14" [15] "My item = 15" [16] "My item = 16" [17] "My item = 17" [18] "My item = 18" [19] "My item = 19" [20] "My item = 20" [21] "My item = 21" [22] "My item = 22" [23] "My item = 23" [24] "My item = 24" [25] "My item = 25" [26] "My item = 26" [27] "My item = 27" [28] "My item = 28" [29] "My item = 29" [30] "My item = 30" [31] "My item = 31" [32] "My item = 32" Please see |
Beta Was this translation helpful? Give feedback.
-
So with that program, I only see one iteration 2000ms later. How would you loop through a table of say 100 values one by one - I don't see where the counter is like in the closure example I posted?
|
Beta Was this translation helpful? Give feedback.
-
Here is a modified version processing a table: It's a bit convoluted but interesting nevertheless. |
Beta Was this translation helpful? Give feedback.
I think you have two choices: