From 9ffcaaa1f99a185bec4160399d0b8f52a70a7527 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Mon, 12 Jan 2009 04:05:10 +0000 Subject: Add core.actions for managing server 'actions'; and make modulemanager register actions 'load' and 'unload' --- core/actions.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 core/actions.lua (limited to 'core/actions.lua') diff --git a/core/actions.lua b/core/actions.lua new file mode 100644 index 00000000..d0be5aeb --- /dev/null +++ b/core/actions.lua @@ -0,0 +1,19 @@ + +local actions = {}; + +function register(path, t) + local curr = actions; + for comp in path:gmatch("([^/]+)/") do + if curr[comp] == nil then + curr[comp] = {}; + end + curr = curr[comp]; + if type(curr) ~= "table" then + return nil, "path-taken"; + end + end + curr[path:match("/([^/]+)$")] = t; + return true; +end + +return { actions = actions, register= register }; \ No newline at end of file -- cgit v1.2.3