Access to all control attributes?

I see that control:print() lists all the attributes associated with a control.
(or similarly value:print() attributes)

I would like to be able to retrieve the formatter function associated with a control ID (and maybe eventually other stuff)

I tried ctl:getFormatter() and val:getFormatter() with no success.

Alternately, is there a nice way to dump the print() output to a variable that I can then parse?

yes, extending this is important. For you guys - so that you can do more in your presets - and also to myself to be able to deliver new features. I am currently working on making Control object (and possibly others in future) more like a real object. That means making it possible to inherit from it, extend the instance and class attributes and functions, and provide getters/setters for all low-level attributes.

eg. Amongst others I will use it for overriding internal paint and touch methods with Lua functions. Like this:

There is a catch though. Adding extra functions (even plain getters / setters) will have quite an impact on memory available on mk1. I very unhappy about that but I feel that the moment when I will have to break compatibility between mk1 and mk2 is coming :frowning:


Great news. In my case, I have a set of controls that need to display different formatting depending on what data has been put in a mod matrix. Luckily, my format routines are named fmt1(), fmt7(), etc.

So for now I can do this:

_G["fmt" .. ctlNum](valueObject, value) to call the correct formatter


I also acknowledge the point about retro compatibility. However, the mk2 represents a significant evolution that inherently offers much more functionality than the mk1. I don’t overlook the fact that the mk1 is already one of the most advanced MIDI controllers out there! Even though it may not match the capabilities of the mk2, it still performs exceptionally well!

In other words, even if the mk1 may not be capable of achieving as much as the mk2, it already surpasses many other controllers. Therefore, the compatibility of the former should not hinder the advancement of the mk2, in my opinion.

Lastly, I want to express my gratitude for all the hard work and innovations! The XY pad is fantastic! Thank youuuu so mutch ! :slight_smile:

1 Like

I guess lua doesn’t have a method_missing sort of handler though I did come across this:

I’m not sure if you can futz with the function table enough to get most of those getters and setters filled in by a single function.

1 Like

yup, I am using the __index and __new_index to manage adding of extra methods added in Lua (and making them known to the C++ part of the firmware). I will give this some thinking. Maybe with a bit of metadata added to the C++ classes, I could be able to map it dynamically. Good thinking! Thanks!