# HG changeset patch # User Kim Alvefur # Date 1587658596 -7200 # Node ID b53193bb21ccfbb34116fdbbad5c3978db31a567 # Parent c9d1d9c80e1e8b138af348e08847492b8b8aa9b8 util.rsm: Fix passing number as attribute diff -r c9d1d9c80e1e -r b53193bb21cc util/rsm.lua --- a/util/rsm.lua Thu Apr 23 18:05:00 2020 +0200 +++ b/util/rsm.lua Thu Apr 23 18:16:36 2020 +0200 @@ -11,9 +11,14 @@ local stanza = require"util.stanza".stanza; local tostring, tonumber = tostring, tonumber; +local s_format = string.format; local type = type; local pairs = pairs; +local function inttostr(n) + return s_format("%d", n); +end + local xmlns_rsm = 'http://jabber.org/protocol/rsm'; local element_parsers = {}; @@ -45,7 +50,7 @@ local element_generators = setmetatable({ first = function(st, data) if type(data) == "table" then - st:tag("first", { index = data.index }):text(data[1]):up(); + st:tag("first", { index = inttostr(data.index) }):text(data[1]):up(); else st:tag("first"):text(tostring(data)):up(); end