Diff

util/multitable.lua @ 6777:5de6b93d0190

util.*: Remove use of module() function, make all module functions local and return them in a table at the end
author Kim Alvefur <zash@zash.se>
date Sat, 21 Feb 2015 10:36:37 +0100
parent 5776:bd0ff8ae98a8
child 7185:5687788a2e4d
line wrap: on
line diff
--- a/util/multitable.lua	Mon Aug 10 22:16:05 2015 +0200
+++ b/util/multitable.lua	Sat Feb 21 10:36:37 2015 +0100
@@ -10,7 +10,7 @@
 local t_insert = table.insert;
 local unpack, pairs, next, type = unpack, pairs, next, type;
 
-module "multitable"
+local _ENV = nil;
 
 local function get(self, ...)
 	local t = self.data;
@@ -126,7 +126,7 @@
 	return results;
 end
 
-function iter(self, ...)
+local function iter(self, ...)
 	local query = { ... };
 	local maxdepth = select("#", ...);
 	local stack = { self.data };
@@ -161,7 +161,7 @@
 	return it, self;
 end
 
-function new()
+local function new()
 	return {
 		data = {};
 		get = get;
@@ -174,4 +174,7 @@
 	};
 end
 
-return _M;
+return {
+	iter = iter;
+	new = new;
+};