Comparison

core/actions.lua @ 698:d8a678e40a0a

Add core.actions for managing server 'actions'; and make modulemanager register actions 'load' and 'unload'
author Matthew Wild <mwild1@gmail.com>
date Mon, 12 Jan 2009 04:05:10 +0000
child 1522:569d58d21612
comparison
equal deleted inserted replaced
697:8ddc85fa7602 698:d8a678e40a0a
1
2 local actions = {};
3
4 function register(path, t)
5 local curr = actions;
6 for comp in path:gmatch("([^/]+)/") do
7 if curr[comp] == nil then
8 curr[comp] = {};
9 end
10 curr = curr[comp];
11 if type(curr) ~= "table" then
12 return nil, "path-taken";
13 end
14 end
15 curr[path:match("/([^/]+)$")] = t;
16 return true;
17 end
18
19 return { actions = actions, register= register };