Hacker News new | ask | show | jobs
by pfalcon 3771 days ago
Because some people disagree that Lua is nice language. Lean-ness is questionable, e.g. BrainFuck is much more "lean", so what? MicroPython can be built to the same binary sizes as a typical Lua build, and yet offer more language features. Lua's embedability has stronghold in games, that's where it usually embedded. Embedded hardware systems are a little different beasts. For them, it's helpful to differentiate e.g. integer from float number (Lua's numbers are floats, it took Lua a long way to acquire a standard module to do bitwise operations, which some people consider just an ugly hack). Also, helpful to differentiate arrays with guaranteed O(1) access from dictionaries (Lua has some mutant container type about whose behavior you can never be sure).
1 comments

Lua 5.3 released recently and has integers and bitwise operators. Array access is also O(1) as long as you use integer keys and don't have any "holes" in the array.
That's what I mean - recently. With more than 20-year Lua history, finally recently adding bitwise operations to the core language is move welcomed by Lua community. No talking about the fact that Lua authors still can't find right pattern for modules, so in 5.3 they smashed how it was in 5.2 and few previous versions (and that's not the 1st time IIRC), and welcomed community to redo their homework on that part. That only emphasizing the fact that Lua is intended for adhoc embedding, like, you put it in your game, wrap your game's objects. Anything else - well, depends. Changes in 5.3 is a reason why a lot of community is on 5.2. (Well, to be fair, there's Python2/Python3 split too, MicroPython is Py3.)

> Array access is also O(1) as long as you use integer keys and don't have any "holes" in the array.

Right, if you don't have "holes", if you start array indexing from arbitrary number (it would be cool to start indexing from e.g. Pi btw, too bad Lua isn't orthodox enough to do that ;-) ), then it's O(1). Otherwise, it's phase of moon dependent (pun intended).