util/import.lua

1
-- Prosody IM
2
-- Copyright (C) 2008-2010 Matthew Wild
3
-- Copyright (C) 2008-2010 Waqas Hussain
4
-- 
5
-- This project is MIT/X11 licensed. Please see the
6
-- COPYING file in the source package for more information.
7
--
8
 
9
 
10
 
11
local t_insert = table.insert;
12
function import(module, ...)
13
	local m = package.loaded[module] or require(module);
14
	if type(m) == "table" and ... then
15
		local ret = {};
16
		for _, f in ipairs{...} do
17
			t_insert(ret, m[f]);
18
		end
19
		return unpack(ret);
20
	end
21
	return m;
22
end