diff options
author | Kim Alvefur <zash@zash.se> | 2020-06-03 19:46:17 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2020-06-03 19:46:17 +0200 |
commit | 3a3d0bad1c2dfe2437488c1dfa12ca98f9a1b5b5 (patch) | |
tree | a21bf15c4b0f658148cf6fc3f60423a3afde5dc2 /util/human | |
parent | 7c630e91836aba13141dee803d07739a1a2d76b7 (diff) | |
download | prosody-3a3d0bad1c2dfe2437488c1dfa12ca98f9a1b5b5.tar.gz prosody-3a3d0bad1c2dfe2437488c1dfa12ca98f9a1b5b5.zip |
util.human.units: Handle location of unpack() in Lua 5.1
Diffstat (limited to 'util/human')
-rw-r--r-- | util/human/units.lua | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/util/human/units.lua b/util/human/units.lua index 2c4662cd..91d6f0d5 100644 --- a/util/human/units.lua +++ b/util/human/units.lua @@ -1,3 +1,5 @@ +local unpack = table.unpack or unpack; --luacheck: ignore 113 + local large = { "k", 1000, "M", 1000000, @@ -49,7 +51,7 @@ local function format(n, unit, b) --> string round = math.ceil; end local m = math.max(0, math.min(8, round(math.abs(math.log(math.abs(n), logbase))))); - local prefix, multiplier = table.unpack(prefixes, m * 2-1, m*2); + local prefix, multiplier = unpack(prefixes, m * 2-1, m*2); return fmt:format(n / (multiplier or 1), prefix or "", unit); end |