Declarative properties on Controls

It would be be useful to be able assign arbitrary properties to Controls in the editor.

These properties could then be used in formatters and other callback to customize the behavior. This avoids the need to have a seperate table in lua code that maps the control id to it’s properties. The idea is the data in the editor/json can drive arbitrary behavior and is local to the control being created. It avoids the need to match up controls with ids in a table, to jump to lua code, and manage the data of associated with the control in a separate edit context and seperate lifecycle (e.g, you add or delete a copntrol, you no longer need to add or delete a table entry in a standalone lua property table.

Ideally it a property list as a lua table object but even a single string attribute would be useful and could be parsed to extract multiple values.

Hoping this description makes sense. It’s simpler than it sounds.

Since Lua is an object oriented language it provides means to do that. There is an example of extending a control at [Lua] Inheritance

There are also other ways to achieve this; this is just one possible approach. However, it does require some additional boilerplate code. The question, however, is how often it would actually be used and whether an extra table of custom properties would become unnecessary overhead if it is rarely used.

The control at [Lua] Inheritance does not appear to expose a value (string) that is set on the control from the editor proper.

The idea is to pass values set in the non-lua part of the editor and use that in other places.