summaryrefslogtreecommitdiffhomepage
path: root/core
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-05-22 17:21:30 +0000
committerSteven Barth <steven@midlink.org>2008-05-22 17:21:30 +0000
commitb515d6f88e8cbfe1b742d0a5cc99aa2d55b6c38e (patch)
tree54974b75609a670549c83864684f81f7a24ccc41 /core
parent505c3208c90d649cd2397a100c93925d480cce91 (diff)
* Changed Makefiles to use mainline Lua
* Added a dispatching shortcut (thanks to Jow)
Diffstat (limited to 'core')
-rw-r--r--core/src/dispatcher.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/core/src/dispatcher.lua b/core/src/dispatcher.lua
index 84c665eda..a05c8805c 100644
--- a/core/src/dispatcher.lua
+++ b/core/src/dispatcher.lua
@@ -137,11 +137,30 @@ function createindex()
end
end
+-- Shortcut for creating a dispatching node
+function entry(path, target, title, order, add)
+ add = add or {}
+
+ local c = node(path)
+ c.target = target
+ c.title = title
+ c.order = order
+
+ for k,v in pairs(add) do
+ c[k] = v
+ end
+
+ return c
+end
-- Fetch a dispatching node
function node(...)
local c = tree
+ if arg[1] and type(arg[1]) == "table" then
+ arg = arg[1]
+ end
+
for k,v in ipairs(arg) do
if not c.nodes[v] then
c.nodes[v] = {nodes={}}