environment.lua

Sat, 12 Sep 2009 21:27:57 +0300

author
Tuomo Valkonen <tuomov@iki.fi>
date
Sat, 12 Sep 2009 21:27:57 +0300
changeset 2
3975fa5ed630
permissions
-rw-r--r--

(don't know)


local hierarchy={}

local function descend(hierarchy, dir)
    local loca=hierarchy
    string.gsub(dir, "([^/]+)", 
        function(d)
            loca=hierarchy[d]
            assert(loca)
        end)
    return loca
end

-- Tai sit vaan jokainen dokumentti ilman extensiota.

function get_shortcuts(dir)
    --local loca=descend(hierarchy, dir)
    return {} --append(loca, append(hierarchy, {}))
end

function get_environment(dir)
    return {
        location=dir,
        shortcuts=get_shortcuts(dir)
    }
end

mercurial