If you haven't heard of Lua, it's a really small programming language. Maybe you have heard of it, but never had a reason to learn it because your programming language of choice does everything you need it to. Well, here are a few reasons you should learn Lua anyway.
Have you heard/used nginx? You can use mini Lua scripts inside of nginx with the openresty setup. This would allow you to do things like dynamically assign SSL certs through Let's Encrypt to different domains.
return ngx.re.match(domain, "^(mysite.com|yoursite.com)$", "ijo")
Use Apahce instead of nginx? Lua still has you covered.
Another popular tool that is used in the web is Redis. If you use redis to store lists of timeline event IDs or something, you may need to do some crazy sorting on this data. Writing
RPOPLPUSH statements in redis can get a little crazy, and sometimes the language you choose may not be as fast as you'd like. For example, if you're using ruby, there's a gem called Wolverine. You write a Lua script that does all the crazy sorting you need, and then pass that data back to your rails app. This gives you a massive performance boost.
If you need lots of performance for your web app, but you don't have the capacity to re-write in something different, then you may employ heavy cache in to your app. One way to do this is to throw Varnish in front of your app. Varnish will handle all the cache, and only proxy back to your app when the cache is expired.
Varnish uses these vcl scripts which can get a little confusing. With a little lua magic you can write some nice programmatic cacheing. Maybe cache different lengths based on the domain in a multi-tenant situation?
Are you big in to playing video games? Maybe you've heard of some of these?
- Angry Birds
- Civilization V
- Far Cry
- Garry's Mod
- Heroes of Might and Magic V
- L.A. Noire
- Mafia II
- Saints Row 2
- SimCity 4
- Star Wars Battlefront
- World of Warcraft
All of these games use Lua in some capacity, and there's MANY more. Most games or game engines will be written in C++ or C#, but using Lua on the front end for scripting allows for rapid development of these games. No need to re-compile each time. Compile your engine, and have it run the lua scripts. You can get started with Love2d or defold
Because Lua is fun to write! If you don't know it, it wouldn't hurt to learn a new language. If you already know how to program, picking up lua should be pretty quick. Read over this 15 min of lua, and you will have a decent understanding of the syntax. At that point it's just a matter of digging in!