Flapping those wings

The feeling of having finished something is just wonderful. Now that I’m pretty much done with this blog which I equipped with Markdown, SmartyPants, CodePrettify, a basic search engine, tags, and a monochromatic look, all that’s left is getting used to maintaining it. Too much to do and too little time to do it. I’ll just post my favourite Lua hack for now:

function _trace(ignore, level)
    level = type(level) == "number" and level
    local errorLevel = 3 + (type(ignore) == "number" and ignore or 0)
    local errorDiff = errorLevel
    local errorPos
    local result = {}
        errorPos = select(2, pcall(error, "@",
        errorLevel)):match("^(.+): @$")
        if errorPos then
            result[#result + 1] = errorPos
            errorLevel = errorLevel + 1
            if errorLevel - errorDiff == level then return result end
    until not errorPos
    return result