What does happen if you would do this?:
doc_ref.value = doc2.value
i thought doc_ref and doc2 are defined as functions after creation and not tables, but you can be sure by oprint or rprint the doc_ref in the terminal.
the UI elements only get the values updated when doc_ref points to doc1.
So, noone?
Am I thinking the wrong way?
I want to have a set of UI elements that are bound to document variables and I want to be able to switch between different documents, but not by loading from an xml file.
Do I need to manually copy every value? If so, is there no way to loop trough the document variables? Do I need explicitly say doc_ref.my_value.value = doc1.my_value.value for each property?
I remember something along the lines of “must set each value separately” being hinted at in the past. If so, all I can think of for looping through the values is to have a reference table for the keys to set. To elaborate on this speculation with some UNTESTED Lua:
If your document table is setup so:
for set_key, set_value in pairs(doc_new_values) do
doc.set_key.value = set_value
end
If that works, you could probably wrap that in a convenient function, too. This could be a bit oversimplified, or maybe won’t apply to your situation, but maybe this helps…