aboutsummaryrefslogtreecommitdiffstats
path: root/util/import.lua
diff options
context:
space:
mode:
Diffstat (limited to 'util/import.lua')
-rw-r--r--util/import.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/util/import.lua b/util/import.lua
new file mode 100644
index 00000000..6aab0d45
--- /dev/null
+++ b/util/import.lua
@@ -0,0 +1,13 @@
+
+local t_insert = table.insert;
+function import(module, ...)
+ local m = package.loaded[module] or require(module);
+ if type(m) == "table" and ... then
+ local ret = {};
+ for _, f in ipairs{...} do
+ t_insert(ret, m[f]);
+ end
+ return unpack(ret);
+ end
+ return m;
+end