# HG changeset patch # User Kim Alvefur # Date 1587660167 -7200 # Node ID 1fbfcc2f68054fcbd1ade4b2302f6354a80c80f6 # Parent e0e2ae050d6549a25f6ba20f8b010e8a37ce96b9 util.rsm: Don't convert values to strings that should already be strings Causes util.stanza to throw an error, which helps detect mistakes diff -r e0e2ae050d65 -r 1fbfcc2f6805 util/rsm.lua --- a/util/rsm.lua Thu Apr 23 18:40:57 2020 +0200 +++ b/util/rsm.lua Thu Apr 23 18:42:47 2020 +0200 @@ -10,7 +10,7 @@ -- local stanza = require"util.stanza".stanza; -local tostring, tonumber = tostring, tonumber; +local tonumber = tonumber; local s_format = string.format; local type = type; local pairs = pairs; @@ -52,14 +52,14 @@ if type(data) == "table" then st:tag("first", { index = inttostr(data.index) }):text(data[1]):up(); else - st:tag("first"):text(tostring(data)):up(); + st:tag("first"):text(data):up(); end end; before = function(st, data) if data == true then st:tag("before"):up(); else - st:tag("before"):text(tostring(data)):up(); + st:tag("before"):text(data):up(); end end; max = function (st, data) @@ -71,7 +71,7 @@ }, { __index = function(_, name) return function(st, data) - st:tag(name):text(tostring(data)):up(); + st:tag(name):text(data):up(); end end; });