projects
/
oweals
/
luci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d8f5ce4
)
* libs/web: Added .leaf attribute to dispatching tree to stop dispatching at a certai...
author
Steven Barth
<steven@midlink.org>
Thu, 29 May 2008 19:18:49 +0000
(19:18 +0000)
committer
Steven Barth
<steven@midlink.org>
Thu, 29 May 2008 19:18:49 +0000
(19:18 +0000)
* libs/web: Added rewrite target for advanced aliasing
libs/web/luasrc/dispatcher.lua
patch
|
blob
|
history
diff --git
a/libs/web/luasrc/dispatcher.lua
b/libs/web/luasrc/dispatcher.lua
index 14801c633505190cf4458b8ba878d82e6d1c2a9c..d1fcdcd0fc017105eadf7ce859c0e3a70d1a2a0f 100644
(file)
--- 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