You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As the subject says... the following adds options to optionally duplicate subtables found in values and/or keys and maintains the structure of multiple table references within the same table:
My only reason for not creating a pull request yet is because I have some questions:
this uses recursion (only when either incSubTables or incKeySubTables is true), which means a sufficiently large table could conceivably overflow the stack... do we think this is an issue? I know that in theory any recursive function can be re-written with an appropriate iterator, I just haven't thought it out yet and I'm trying to decide if it's worth the effort...
relies on pairs so subject to metamethods and thus may not create a "true" copy... been thinking about a way to convert this to use next and rawget which would avoid metamethods altogether.
doesn't replicate metatables on tables (or subtables), if any... would this be worth adding as well?
It should also be noted that functions and userdata as values/keys may in some cases and senses be "duplicatable" as well, but these are so instance specific that I'm not going to worry about them... it's never come up in my requirements yet at any rate, but the issue of sub-tables has (again, for me at least).
edit - fixed misnamed incKeySubTables in discussion points
The text was updated successfully, but these errors were encountered:
As the subject says... the following adds options to optionally duplicate subtables found in values and/or keys and maintains the structure of multiple table references within the same table:
My only reason for not creating a pull request yet is because I have some questions:
incSubTables
orincKeySubTables
is true), which means a sufficiently large table could conceivably overflow the stack... do we think this is an issue? I know that in theory any recursive function can be re-written with an appropriate iterator, I just haven't thought it out yet and I'm trying to decide if it's worth the effort...pairs
so subject to metamethods and thus may not create a "true" copy... been thinking about a way to convert this to usenext
andrawget
which would avoid metamethods altogether.It should also be noted that functions and userdata as values/keys may in some cases and senses be "duplicatable" as well, but these are so instance specific that I'm not going to worry about them... it's never come up in my requirements yet at any rate, but the issue of sub-tables has (again, for me at least).
edit - fixed misnamed
incKeySubTables
in discussion pointsThe text was updated successfully, but these errors were encountered: