From 75ca81a26e86df0fae6a39913d9ff2ff480e2211 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 25 Apr 2021 17:32:27 +0200 Subject: util.prosodyctl.shell: Fix for different location of unpack in Lua 5.1 --- util/prosodyctl/shell.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'util/prosodyctl') diff --git a/util/prosodyctl/shell.lua b/util/prosodyctl/shell.lua index 4e112a14..79d96f15 100644 --- a/util/prosodyctl/shell.lua +++ b/util/prosodyctl/shell.lua @@ -3,6 +3,7 @@ local server = require "net.server"; local st = require "util.stanza"; local path = require "util.paths"; local parse_args = require "util.argparse".parse; +local unpack = table.unpack or _G.unpack; local have_readline, readline = pcall(require, "readline"); @@ -75,7 +76,7 @@ local function start(arg) --luacheck: ignore 212/arg if arg[2] then -- prosodyctl shell module reload foo bar.com --> module:reload("foo", "bar.com") -- 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)); + arg[1] = string.format("%s:%s("..string.rep("%q, ", #arg-2):sub(1, -3)..")", unpack(arg)); end client.events.add_handler("connected", function() -- cgit v1.2.3