Comparison

util/human/units.lua @ 12573:0f4feaf9ca64

util: Remove various Lua 5.1 compatibility hacks Part of #1600
author Kim Alvefur <zash@zash.se>
date Sat, 02 Jul 2022 17:31:14 +0200
parent 10903:c5f26f9adb31
child 12589:39ae08180c81
comparison
equal deleted inserted replaced
12572:35a9ed6b7896 12573:0f4feaf9ca64
3 local math_floor = math.floor; 3 local math_floor = math.floor;
4 local math_log = math.log; 4 local math_log = math.log;
5 local math_max = math.max; 5 local math_max = math.max;
6 local math_min = math.min; 6 local math_min = math.min;
7 local unpack = table.unpack or unpack; --luacheck: ignore 113 7 local unpack = table.unpack or unpack; --luacheck: ignore 113
8
9 if math_log(10, 10) ~= 1 then
10 -- Lua 5.1 COMPAT
11 local log10 = math.log10;
12 function math_log(n, base)
13 return log10(n) / log10(base);
14 end
15 end
16 8
17 local large = { 9 local large = {
18 "k", 1000, 10 "k", 1000,
19 "M", 1000000, 11 "M", 1000000,
20 "G", 1000000000, 12 "G", 1000000000,