I came from the JS/HTML5 Scene, and I can imagine quite a number of people coming from the same background.
Anyone here recommend some good libraries to use (preferably functional)? A cursory google search reveals underscore.lua exists, but I’d be interested to hear if there are good original libraries (as in not inspired by javascript counterparts).
Installation/integration with defold would be good too It’s my first foray to lua.
Good question and welcome to the wonderful world of Lua!
As you’ve probably noticed by now the Lua standard libraries are fairly small. This is by design to keep the size of the Lua VM down and it has fostered a culture of DIY programmers that aren’t afraid to do their own thing.
This is often a good thing since a lot of stuff can be expressed very easily in Lua. On the other hand there is a point where it’s better to build on top of things done by others, and that is where things such as the Lua package manager LuaRocks comes in and where curated lists of Lua libraries such as awesome-lua becomes very useful. One very popular utility library is Penlight.
Indeed! I was very surprised to find out (just now) that there is no round function in Lua, and I think I’m starting to get the idea of what Lua was going for (minimal and perfect as an embedded language).
I just saw penlight recommended on another forum because I was looking for a way to pretty print/dump a table and I’m super stoked to know it’s quite fully packed too. Looks like a terrific library, thanks for the recommendation!
One thing to keep in mind when using these kind of libraries is to not go overboard with wrapping stuff into containers and what not and adapt an OOP mentality when it in fact is very counterproductive when you’re working with a language such as Lua. It can take a while to unlearn a lot of bad OOP practices, but since you have a Javascript background it’s probably not going to be that hard for you.
Great! I knew something like pprint is going to be essential to any gamedev library, and glad to see it here I haven’t had the time to fully explore the API yet.
Looking at penlight it is indeed very feature packed, and browsing the interwebs even more it does seem to be the go to utility library (or set of libraries).
No worries about OOP for me, as I personally much prefer functional paradigms too. In fact what made me look into utility libraries is to scratch my itch of using map, reduce, repeat, etc.