# HG changeset patch # User Kim Alvefur # Date 1398856755 -7200 # Node ID 1a5ae0dee1575d9e595fa13de2acf67df014585e # Parent ce5e397a776834263432463fb87be482c7387454 mod_mam/rsm.lib: Pointless optimization diff -r ce5e397a7768 -r 1a5ae0dee157 mod_mam/rsm.lib.lua --- 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({