Hey people who write a lot of Lua code in Roblox, is there a “standard library” for doing common operations like cloning a table that you use? Maybe hidden in one of those core scripts that loads when the game runs?
It’s pretty amazing to me that in a language where everything is a table there is no support for copying tables.
Coincidentally the article also provides an answer to your question about why Lua has no native support for copying tables:
A generic table.copy function is not guaranteed to suit all use-cases, as there are many different aspects which must be selected for the specific situation. For example: should metatables be shared or copied? Should we check userdata for a __copy metamethod?
The Deep copy implementation should cover all cases.
I don’t want to copy that function into every script that wants to use it, or create a new module script containing that function if there is already a “standard library” require that Roblox developers commonly use.
I.E. I DONT WANT TO BUILD MY OWN STANDARD LIBRARY
Put another way, am I missing something or do I really have to implement this myself?