environment.lua

changeset 2
3975fa5ed630
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/environment.lua	Sat Sep 12 21:27:57 2009 +0300
@@ -0,0 +1,26 @@
+
+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