Yeah, those are decisions that needed to be made in order to make Lua simple enough for being embedded. And I find its syntax very smart: it is not object-oriented, but using the : syntax sugar you can pretend it is (Löve does that); if you want to write something in a FP way, you also can do it. Of course it's not like using an OOP or FP language, but it does the job. Other cool syntax sugar is that you can omit the parentheses when calling a function that only have a string or table as a parameter, it is useful for creating simple DSLs. Lua was never meant to be the main language of anyone, but given the problem that it wants to solve, I'm amazed on how much we can do with it!
On the other hand, JS was very similar to Lua. It wasn't object-oriented, but we could pretend it was, just like Lua. However, people started to use it for things that it wasn't meant to do when it was created, and it was extended with more features. Lua still have the same purpose, keeping its simple syntax.
Some years ago, the creator of Lua was invited to my university. He told us about some of the decisions that were made in Lua. For example:
- about it being indexed by 1: at the time, arrays indexed by 0 wasn't as popular as today. Lua was created in 1993, it is older than Java, JS and many other languages that we use today that are 0-based. A decision had to be made, and they chose to start at 1, as it was easier for non-programmers to write formulae
- about it using -- as comments: it was inspired by Haskell
- about it not having a ++ operator: that would increase the complexity of the syntax, and a -- operator wouldn't be possible due to that decision above
On the other hand, JS was very similar to Lua. It wasn't object-oriented, but we could pretend it was, just like Lua. However, people started to use it for things that it wasn't meant to do when it was created, and it was extended with more features. Lua still have the same purpose, keeping its simple syntax.
Some years ago, the creator of Lua was invited to my university. He told us about some of the decisions that were made in Lua. For example:
- about it being indexed by 1: at the time, arrays indexed by 0 wasn't as popular as today. Lua was created in 1993, it is older than Java, JS and many other languages that we use today that are 0-based. A decision had to be made, and they chose to start at 1, as it was easier for non-programmers to write formulae
- about it using -- as comments: it was inspired by Haskell
- about it not having a ++ operator: that would increase the complexity of the syntax, and a -- operator wouldn't be possible due to that decision above