Mercurial > prosody-hg
comparison core/actions.lua @ 709:8bb83563cb21
Automated merge with http://waqas.ath.cx:8000/
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Tue, 13 Jan 2009 15:29:00 +0000 |
| parents | d8a678e40a0a |
| children | 569d58d21612 |
comparison
equal
deleted
inserted
replaced
| 708:b72d408f5f15 | 709:8bb83563cb21 |
|---|---|
| 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 }; |
