* libs/web: Added .leaf attribute to dispatching tree to stop dispatching at a certain node
* libs/web: Added rewrite target for advanced aliasing
This commit is contained in:
parent
d8f5ce4759
commit
3f5f89451e
1 changed files with 16 additions and 1 deletions
|
@ -98,7 +98,7 @@ function dispatch()
|
||||||
|
|
||||||
for i, s in ipairs(request) do
|
for i, s in ipairs(request) do
|
||||||
c = c.nodes[s]
|
c = c.nodes[s]
|
||||||
if not c then
|
if not c or c.leaf then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -282,6 +282,21 @@ function alias(...)
|
||||||
end
|
end
|
||||||
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)
|
function call(name)
|
||||||
return function() getfenv()[name]() end
|
return function() getfenv()[name]() end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue