Also they are passed by reference and not by value. That can be confusing once you edit a value in that tuple.
The passing method doesn't matter if the tuple is immutable (or copy-on-edit) so this isn't an issue.
Regards,
Duane.
I am actually struggling a little how I would implement a
copy-on-edit. The __newindex metamethod gets the userdata and the
field name and the new value as parameters. The userdata is passed
as a reference, but if I am not completely wrong I cannot edit the
original reference, I just get a copy of the reference which is then
placed on the stack. If Lua wanted to support this, it would need to
be possible that the __newindex method returns a value that replaces
the original reference.I haven't tried this so I might be wrong
here.
Anyway the resort to immutable will work for sure.
--
Thomas