util/rsm.lua
changeset 10765 b53193bb21cc
parent 7855 e594010e1ba0
child 10767 e0e2ae050d65
--- 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