Isn't it funny how such a seemingly trivial task as giving a name to a control can get so complicated?
I like the simplicity of Garkin's method. Yes it has a prerequisite, but one that is already there.
Note that every LAM control constructor (except panel, obviously) sets:
Lua Code:
control.panel = parent.panel or parent
Read that line carefully - it means that `parent` has to either have a link to a panel, or
be a panel.
Of course
being a panel doesn't necessarily equal to
being created by LAMCC.panel(). It means
having compatible interface. See how controls use `control.panel.data.something` without asking? They require the panel (i.e. the `parent.panel or parent` from their constructor) to have a `data` table.
So you can't use just about any control as `parent`, it must at least have `.data`, or `.panel` that has it. The additional requirement to have a name seems sensible to me.