3 ms·
As I said in a sibling comment, Lua isn't designed to be good for beginners, it's simple rather than easy. But I want to stand up for this, in particular. Beca
by samatman 6y ago
As I said in a sibling comment, Lua isn't designed to be good for beginners, it's simple rather than easy.
But I want to stand up for this, in particular. Because in most languages, environments are magic: they're an exceptional thing that you work with in a special way, you're not expected to understand them, just use them.
In Lua, an environment is... just a table! You can set an environment, read from it directly, assign it a metatable, and so on.
So this is great for a beginner, once he gets past the hurdle. Just like `table.field` returns `nil` if there's no field field, `field` itself returns nil if there's no `_G.field`. Because _G.field and field itself are the same thing.
- TulliusCicero 6y ago> So this is great for a beginner, once he gets past the hurdle. Is it? Because that still seems very error prone to me. You're not gonna suddenly stop making typos just because you understand that there's an invisible global table around all the time. But hey, maybe it's super awesome later on, though I'm having trouble imagining scenarios where this behavior is all that useful over what most other languages do.