Tuesday, March 14, 2006

You are currently browsing the daily archive for Tuesday, March 14, 2006.

Snake eats moon

I’ve been working on my spare… spare time on some web software for my World of Warcraft guild, principally to offer DKP statistics and character profiles.

I originally anticipated to do that stuff in PHP, but I figured it would be nice to learn something new, so I finally settled on Django, the “Web framework for perfectionists with deadlines”. Django is written in Python, which is a really nice language, not to mention hip at geek parties.

In any case, it hit me last weekend I would have to load World of Warcraft saved variables files, which are just Lua files declaring variables in the global scope. I thought this would be an ordeal and didn’t look forward to writing parsing code, or worse, a formal grammar.

Turns out Lua is so similar to Python a few regular expressions did the trick. I have to admit, I was rather pleased by the simplicity of the solution :)

So there you have it: the wowsv Python module. It exports a single function, aptly named wowsv, to load World of Warcraft saved variables into Python. You can do whatever you want with it, I don’t really care. Just credit me if you’re going to use it, and of course I’d appreciate to know about any changes or improvements you might make to it.

Download wowsv (sha1: 4711ce5a69e774b973bc5de2975051e18da11ee5)

In case you were wondering about the compression, my server would try to execute a straight .py as a CGI script.