Comparison

core/moduleapi.lua @ 6414:31c15004bfb0

core.moduleapi: Use require instead of global to get storagemanager in module:open_store()
author Kim Alvefur <zash@zash.se>
date Wed, 17 Sep 2014 14:47:52 +0200
parent 6165:6a184b16b717
child 6415:010b141e91ed
comparison
equal deleted inserted replaced
6413:a552f4170aed 6414:31c15004bfb0
17 17
18 local t_insert, t_remove, t_concat = table.insert, table.remove, table.concat; 18 local t_insert, t_remove, t_concat = table.insert, table.remove, table.concat;
19 local error, setmetatable, type = error, setmetatable, type; 19 local error, setmetatable, type = error, setmetatable, type;
20 local ipairs, pairs, select, unpack = ipairs, pairs, select, unpack; 20 local ipairs, pairs, select, unpack = ipairs, pairs, select, unpack;
21 local tonumber, tostring = tonumber, tostring; 21 local tonumber, tostring = tonumber, tostring;
22 local require = require;
22 23
23 local prosody = prosody; 24 local prosody = prosody;
24 local hosts = prosody.hosts; 25 local hosts = prosody.hosts;
25 26
26 -- FIXME: This assert() is to try and catch an obscure bug (2013-04-05) 27 -- FIXME: This assert() is to try and catch an obscure bug (2013-04-05)
364 path = resolve_relative_path(self:get_directory(), path); 365 path = resolve_relative_path(self:get_directory(), path);
365 return io.open(path, mode); 366 return io.open(path, mode);
366 end 367 end
367 368
368 function api:open_store(name, type) 369 function api:open_store(name, type)
369 return storagemanager.open(self.host, name or self.name, type); 370 return require"core.storagemanager".open(self.host, name or self.name, type);
370 end 371 end
371 372
372 return api; 373 return api;