3 ms·
> Are either of those things, things that will just come naturally to newbies? Are they definitely gonna know about them when they pick up the language in rando
by djur 6y ago
> Are either of those things, things that will just come naturally to newbies? Are they definitely gonna know about them when they pick up the language in random text or video tutorials?
I think the argument is more that Roblox should be setting up its Lua environment that way.
> In python, you can just go "dict2 = dict(dict1)", or "dict2 = dict1.copy()", both of those are easy enough, and more importantly, they're intuitive: want a copy? Call the copy function!
A shallow copy, which can be very surprising. And since Lua has metatables and userdata, it's impossible to write a deep copy that works correctly in all circumstances.
- viraptor 6y agoI'm not super experienced with Lua - what's missing for a generic deep copy? Is there no real reflection system?
- djur 6y agoLua has a type of value called "userdata" that is just an opaque reference to a C resource. There's no way for Lua to know how do a deep copy of that resource, if it's possible at all. Tables can also have "metatables" that modify how they function. It's not obvious whether a deep copy should also create a deep copy of the metatable (and its metatable, and so on) or whether the copy should share the original metatable. There's good arguments either way.