intechstudio / grid-fw

GNU General Public License v3.0
24 stars 7 forks source link

Feature request: Dynamically adressable element indices #98

Closed narayb closed 2 months ago

narayb commented 3 months ago

When writing a lua script for a module and wanting that to be applicable for multiple module types, it would be nice to have a way to address elements in a different- dynamic manner.

Adding a function that returns the highest numbered element would be neat as a start. This way one could always address the system element on all kinds of modules like so:

print(element[element_count()]:element_index())
-- for example this would return 12 on a PBF4 but 16 on an EN16

There could be a workaround with the length operator?

SukuWc commented 2 months ago

rint(element[element_count()-1]:element_index()) will return the element index of the system element. Available in nightly fw, use gec() instead of element_count() until if gets supported in grid editor!