diff options
author | Matthew Wild <mwild1@gmail.com> | 2010-01-21 01:08:50 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2010-01-21 01:08:50 +0000 |
commit | 23b248cfbeaba59ce9db8465bd4bf72155f1786d (patch) | |
tree | f65fbdcbaf0b2965c9ae07bf1cc3ad7a5a516004 /core | |
parent | 84bf388d88e8e76cac8d897704e56d80e4a4a8f3 (diff) | |
download | prosody-23b248cfbeaba59ce9db8465bd4bf72155f1786d.tar.gz prosody-23b248cfbeaba59ce9db8465bd4bf72155f1786d.zip |
objectmanager: Obsolete, remove
Diffstat (limited to 'core')
-rw-r--r-- | core/objectmanager.lua | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/core/objectmanager.lua b/core/objectmanager.lua deleted file mode 100644 index 293622c9..00000000 --- a/core/objectmanager.lua +++ /dev/null @@ -1,68 +0,0 @@ --- Prosody IM --- Copyright (C) 2008-2009 Matthew Wild --- Copyright (C) 2008-2009 Waqas Hussain --- --- This project is MIT/X11 licensed. Please see the --- COPYING file in the source package for more information. --- - - -local new_multitable = require "util.multitable".new; -local t_insert = table.insert; -local t_concat = table.concat; -local tostring = tostring; -local unpack = unpack; -local pairs = pairs; -local error = error; -local type = type; -local _G = _G; - -local data = new_multitable(); - -module "objectmanager" - -function set(...) - return data:set(...); -end -function remove(...) - return data:remove(...); -end -function get(...) - return data:get(...); -end - -local function get_path(path) - if type(path) == "table" then return path; end - local s = {}; - for part in tostring(path):gmatch("[%w_]+") do - t_insert(s, part); - end - return s; -end - -function get_object(path) - path = get_path(path) - return data:get(unpack(path)), path; -end -function set_object(path, object) - path = get_path(path); - data:set(unpack(path), object); -end - -data:set("ls", function(_dir) - local obj, dir = get_object(_dir); - if not obj then error("object not found: " .. t_concat(dir, '/')); end - local r = {}; - if type(obj) == "table" then - for key, val in pairs(obj) do - r[key] = type(val); - end - end - return r; -end); -data:set("get", get_object); -data:set("set", set_object); -data:set("echo", function(...) return {...}; end); -data:set("_G", _G); - -return _M; |