Comparison

util/prosodyctl/shell.lua @ 11521:16caf35f031f

util.prosodyctl.shell: Fix for missing 'sep' arg to string.rep in Lua 5.1
author Kim Alvefur <zash@zash.se>
date Sun, 25 Apr 2021 17:27:02 +0200
parent 11520:0a464a6e88c4
child 11522:5bd38d9197e1
comparison
equal deleted inserted replaced
11520:0a464a6e88c4 11521:16caf35f031f
72 end 72 end
73 73
74 if arg[1] then 74 if arg[1] then
75 if arg[2] then 75 if arg[2] then
76 -- prosodyctl shell module reload foo bar.com --> module:reload("foo", "bar.com") 76 -- prosodyctl shell module reload foo bar.com --> module:reload("foo", "bar.com")
77 arg[1] = string.format("%s:%s("..string.rep("%q", #arg-2, ", ")..")", table.unpack(arg)); 77 -- COMPAT Lua 5.1 doesn't have the separator argument to string.rep
78 arg[1] = string.format("%s:%s("..string.rep("%q, ", #arg-2):sub(1, -3)..")", table.unpack(arg));
78 end 79 end
79 80
80 client.events.add_handler("connected", function() 81 client.events.add_handler("connected", function()
81 client.send(st.stanza("repl-input"):text(arg[1])); 82 client.send(st.stanza("repl-input"):text(arg[1]));
82 return true; 83 return true;