<< Blog Index

Premake and Lua
April 19, 2020

If you’re looking to use an interesting build system, maybe you should try out premake, a “powerfully simple build configuration.” I was recommended it some years ago when I was looking for alternatives to CMake. Now, just as with any software that is less used, less popular, and less backed, I was a little skeptical at first about it, if my time invested in using it wouldn’t be wasted (in the event I hit a wall and would have to switch to CMake anyway). So far it has fit my needs for a couple of projects. It’s also extremely easy to learn, even if you aren’t too familiar with Lua.

That being said, I’d like to point out something. Lua is an extremely bare-bones language. It’s very friendly towards smaller systems due to its compact nature and principles that deliberately and aggressively promote simplicity. It’s a beautiful language, honestly, but it does have its caveats, particularly that it is simple. Take Python for a contrasting example, which has so many libraries easily available that are easy to install and use for just about everything you can think about. With Lua you have to jump through a few hoops to get something to do what you want.

One time I was scripting something in Lua, only to hit a brick wall when I wanted to make an HTTP (or HTTPS, I think?) request. I ended up just calling a Python script from within the Lua script (lol??) to do the web request. That was what I considered to be the simplest solution to the problem, heh.

I’m kind of rambling, but the point I’m trying to make is that premake chose the wrong language. Lua is for when you want a small footprint, such as for performance or control over its small implementation (easy to modify). Python is when you want solid scripting power. While there are some benefits, like embedding lua into the program directly, I think Python would have been a better choice. I think it would also be pretty neat if CMake ditched its shitty basic language in favor of just using Python.

<< Blog Index