changeset 1401:1a5ae0dee157

mod_mam/rsm.lib: Pointless optimization
author Kim Alvefur <zash@zash.se>
date Wed, 30 Apr 2014 13:19:15 +0200
parents ce5e397a7768
children 57ee26681561
files mod_mam/rsm.lib.lua
diffstat 1 files changed, 9 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/mod_mam/rsm.lib.lua	Wed Apr 30 13:14:02 2014 +0200
+++ b/mod_mam/rsm.lib.lua	Wed Apr 30 13:19:15 2014 +0200
@@ -5,9 +5,10 @@
 
 local xmlns_rsm = 'http://jabber.org/protocol/rsm';
 
-local element_parsers;
+local element_parsers = {};
 
 do
+	local parsers = element_parsers;
 	local function xs_int(st)
 		return tonumber((st:get_text()));
 	end
@@ -15,21 +16,19 @@
 		return st:get_text();
 	end
 
-	element_parsers = {
-		after = xs_string;
-		before = function(st)
+	parsers.after = xs_string;
+	parsers.before = function(st)
 			local text = st:get_text();
 			return text == "" or text;
 		end;
-		max = xs_int;
-		index = xs_int;
+	parsers.max = xs_int;
+	parsers.index = xs_int;
 
-		first = function(st)
+	parsers.first = function(st)
 			return { index = tonumber(st.attr.index); st:get_text() };
 		end;
-		last = xs_string;
-		count = xs_int;
-	}
+	parsers.last = xs_string;
+	parsers.count = xs_int;
 end
 
 local element_generators = setmetatable({