Software /
code /
prosody
Diff
util/human/units.lua @ 10888:42a0d9089de9
util.human.units: Handle location of unpack() in Lua 5.1
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 03 Jun 2020 19:46:17 +0200 |
parent | 10886:994c4a333199 |
child | 10889:25e0ec11b4e4 |
line wrap: on
line diff
--- a/util/human/units.lua Wed Jun 03 19:27:44 2020 +0200 +++ b/util/human/units.lua Wed Jun 03 19:46:17 2020 +0200 @@ -1,3 +1,5 @@ +local unpack = table.unpack or unpack; --luacheck: ignore 113 + local large = { "k", 1000, "M", 1000000, @@ -49,7 +51,7 @@ 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