From 0f8ba47525595a9432b4060204d943cfb26bdc61 Mon Sep 17 00:00:00 2001
From: Matthew Wild <mwild1@gmail.com>
Date: Sat, 4 Oct 2008 02:43:23 +0100
Subject: New "import" module to help tidy up all the local declarations at the
 top of modules

---
 util/import.lua | 13 +++++++++++++
 1 file changed, 13 insertions(+)
 create mode 100644 util/import.lua

(limited to 'util')

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
-- 
cgit v1.2.3