util.prosodyctl.shell: Fix for missing 'sep' arg to string.rep in Lua 5.1
authorKim Alvefur <zash@zash.se>
Sun, 25 Apr 2021 17:27:02 +0200
changeset 11525 16caf35f031f
parent 11524 0a464a6e88c4
child 11526 5bd38d9197e1
util.prosodyctl.shell: Fix for missing 'sep' arg to string.rep in Lua 5.1
util/prosodyctl/shell.lua
--- a/util/prosodyctl/shell.lua	Sun Apr 25 17:20:58 2021 +0200
+++ b/util/prosodyctl/shell.lua	Sun Apr 25 17:27:02 2021 +0200
@@ -74,7 +74,8 @@
 	if arg[1] then
 		if arg[2] then
 			-- prosodyctl shell module reload foo bar.com --> module:reload("foo", "bar.com")
-			arg[1] = string.format("%s:%s("..string.rep("%q", #arg-2, ", ")..")", table.unpack(arg));
+			-- COMPAT Lua 5.1 doesn't have the separator argument to string.rep
+			arg[1] = string.format("%s:%s("..string.rep("%q, ", #arg-2):sub(1, -3)..")", table.unpack(arg));
 		end
 
 		client.events.add_handler("connected", function()