diff options
Diffstat (limited to 'core/actions.lua')
-rw-r--r-- | core/actions.lua | 19 |
1 files changed, 19 insertions, 0 deletions
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 |