Comparison

util/prosodyctl/shell.lua @ 11522:5bd38d9197e1

util.prosodyctl.shell: Fix for different location of unpack in Lua 5.1
author Kim Alvefur <zash@zash.se>
date Sun, 25 Apr 2021 17:32:27 +0200
parent 11521:16caf35f031f
child 11890:b9aab1962a2b
comparison
equal deleted inserted replaced
11521:16caf35f031f 11522:5bd38d9197e1
1 local config = require "core.configmanager"; 1 local config = require "core.configmanager";
2 local server = require "net.server"; 2 local server = require "net.server";
3 local st = require "util.stanza"; 3 local st = require "util.stanza";
4 local path = require "util.paths"; 4 local path = require "util.paths";
5 local parse_args = require "util.argparse".parse; 5 local parse_args = require "util.argparse".parse;
6 local unpack = table.unpack or _G.unpack;
6 7
7 local have_readline, readline = pcall(require, "readline"); 8 local have_readline, readline = pcall(require, "readline");
8 9
9 local adminstream = require "util.adminstream"; 10 local adminstream = require "util.adminstream";
10 11
73 74
74 if arg[1] then 75 if arg[1] then
75 if arg[2] then 76 if arg[2] then
76 -- prosodyctl shell module reload foo bar.com --> module:reload("foo", "bar.com") 77 -- prosodyctl shell module reload foo bar.com --> module:reload("foo", "bar.com")
77 -- COMPAT Lua 5.1 doesn't have the separator argument to string.rep 78 -- 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)); 79 arg[1] = string.format("%s:%s("..string.rep("%q, ", #arg-2):sub(1, -3)..")", unpack(arg));
79 end 80 end
80 81
81 client.events.add_handler("connected", function() 82 client.events.add_handler("connected", function()
82 client.send(st.stanza("repl-input"):text(arg[1])); 83 client.send(st.stanza("repl-input"):text(arg[1]));
83 return true; 84 return true;