Once Upon a Hacknight | NetEngine

Once Upon a Hacknight

It’s my first time attending a hacknight here in the Philippines. I was excited to be able to meet more potential talent for the planned Manila NetEngine office, but the night took a really interesting turn because of the mention of World of Warcraft.

When I was still working for a Philippine company, there was this time when we were addicted to WoW. So when Rad, one of the devs present in the hacknight, mentioned that this scripting language is used in games like WoW, things got interesting.

It was my first time hearing about lua. From the few snippets Rad shown, for me it looks like a hybrid of javascript and ruby. You have functions but instead of curly braces, you use do and end for a block. What’s interesting about lua is that the code can be used in an Nginx location block once you have the module installed. To make things more interesting, there’s a site called OpenResty that bundles “lots of 3rd party Nginx modules” (quoted from their site) which allows nginx to talk directly to other services like Redis, MySQL and PostgreSQL.

So what? What is its uses? Even if nginx can access redis/mysql, I still need my Rails app to serve the templates. This is true. I haven’t researched enough to see if lua can serve some kind of html template so I’m assuming that it doesn’t have that capability, yet. So what do I do with it? The answer: API. APIs usually return an xml or json string which can be done using a lua block. I don’t have any benchmarked stats but having nginx intead of your Rails app handle your API requests, it should be faster, right?