summaryrefslogtreecommitdiffhomepage
path: root/libs/web/luasrc
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-05-29 19:18:49 +0000
committerSteven Barth <steven@midlink.org>2008-05-29 19:18:49 +0000
commit3f5f89451e912039d70eeed9ed3373c72ab1e3f9 (patch)
tree61872f149449e6dee26ef48d834938ced51d4ff1 /libs/web/luasrc
parentd8f5ce4759ac7077fadbcdc90842401b9fa69f2e (diff)
* libs/web: Added .leaf attribute to dispatching tree to stop dispatching at a certain node
* libs/web: Added rewrite target for advanced aliasing
Diffstat (limited to 'libs/web/luasrc')
-rw-r--r--libs/web/luasrc/dispatcher.lua17
1 files changed, 16 insertions, 1 deletions
diff --git a/libs/web/luasrc/dispatcher.lua b/libs/web/luasrc/dispatcher.lua
index 14801c633..d1fcdcd0f 100644
--- a/libs/web/luasrc/dispatcher.lua
+++ b/libs/web/luasrc/dispatcher.lua
@@ -98,7 +98,7 @@ function dispatch()
for i, s in ipairs(request) do
c = c.nodes[s]
- if not c then
+ if not c or c.leaf then
break
end
@@ -282,6 +282,21 @@ function alias(...)
end
end
+function rewrite(n, ...)
+ local req = arg
+ return function()
+ for i=1,n do
+ table.remove(request, 1)
+ end
+
+ for i,r in ipairs(req) do
+ table.insert(request, i, r)
+ end
+
+ dispatch()
+ end
+end
+
function call(name)
return function() getfenv()[name]() end
end