diff options
author | Kim Alvefur <zash@zash.se> | 2021-03-06 15:24:45 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2021-03-06 15:24:45 +0100 |
commit | 4bca398e871017a4566e8e1f3878e8ad763bde0f (patch) | |
tree | 2061cf027860f7bf5f07eaac689901bef0b32148 | |
parent | 89ec64ff8943b57ae0b237876f59e84ea524b8b9 (diff) | |
download | prosody-4bca398e871017a4566e8e1f3878e8ad763bde0f.tar.gz prosody-4bca398e871017a4566e8e1f3878e8ad763bde0f.zip |
util.rsm: Improve readability using compacter stanza building API
At least I think :text_tag improves readability.
-rw-r--r-- | util/rsm.lua | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/util/rsm.lua b/util/rsm.lua index ad725d76..affa85f5 100644 --- a/util/rsm.lua +++ b/util/rsm.lua @@ -52,26 +52,26 @@ local element_generators = setmetatable({ if type(data) == "table" then st:tag("first", { index = inttostr(data.index) }):text(data[1]):up(); else - st:tag("first"):text(data):up(); + st:text_tag("first", data); end end; before = function(st, data) if data == true then st:tag("before"):up(); else - st:tag("before"):text(data):up(); + st:text_tag("before", data); end end; max = function (st, data) - st:tag("max"):text(inttostr(data)):up(); + st:text_tag("max", inttostr(data)); end; count = function (st, data) - st:tag("count"):text(inttostr(data)):up(); + st:text_tag("count", inttostr(data)); end; }, { __index = function(_, name) return function(st, data) - st:tag(name):text(data):up(); + st:text_tag(name, data); end end; }); |