News for hackers. Stuff that matters.
Re:Lua, a Misunderstood Language by djur on Friday January 15, 2021 @06:14PM (#25797869)
> 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.

Re:Lua, a Misunderstood Language by viraptor on Friday January 15, 2021 @07:37PM (#25798635)
I'm not super experienced with Lua - what's missing for a generic deep copy? Is there no real reflection system?
Re:Lua, a Misunderstood Language by djur on Friday January 15, 2021 @11:48PM (#25800131)
Lua 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.