# HG changeset patch # User Kim Alvefur # Date 1591206377 -7200 # Node ID 42a0d9089de95bd08b9f37579606d4c8de9fd680 # Parent 3debe04a6162668d08737ee4534c0aa1430404d8 util.human.units: Handle location of unpack() in Lua 5.1 diff -r 3debe04a6162 -r 42a0d9089de9 util/human/units.lua --- 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