diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/src/dispatcher.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/core/src/dispatcher.lua b/core/src/dispatcher.lua index 84c665edab..a05c8805cb 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={}} |