mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-23 23:53:44 +01:00
Fix more issues discovered by luacheck
This commit is contained in:
parent
64ed01132e
commit
3c414f2dbd
@ -2,11 +2,17 @@ quiet = 1
|
|||||||
codes = true
|
codes = true
|
||||||
|
|
||||||
exclude_files = {
|
exclude_files = {
|
||||||
".luarocks/*"
|
".luarocks/*",
|
||||||
|
"worldeditadditions/utils/bit.lua"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ignore = {"631", "61[124]", "412", "21[123]"}
|
ignore = {
|
||||||
|
"631", "61[124]",
|
||||||
|
"412",
|
||||||
|
"321/bit",
|
||||||
|
"21[123]"
|
||||||
|
}
|
||||||
|
|
||||||
-- Read-write globals (i.e. they can be defined)
|
-- Read-write globals (i.e. they can be defined)
|
||||||
globals = {
|
globals = {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
-- @param decimals number The number of decimal places to show.
|
-- @param decimals number The number of decimal places to show.
|
||||||
-- @return string A formatted string that represents the given input number.
|
-- @return string A formatted string that represents the given input number.
|
||||||
function worldeditadditions.format.human_size(n, decimals)
|
function worldeditadditions.format.human_size(n, decimals)
|
||||||
sizes = { "", "K", "M", "G", "T", "P", "E", "Y", "Z" }
|
local sizes = { "", "K", "M", "G", "T", "P", "E", "Y", "Z" }
|
||||||
local factor = math.floor((#tostring(n) - 1) / 3)
|
local factor = math.floor((#tostring(n) - 1) / 3)
|
||||||
local multiplier = 10^(decimals or 0)
|
local multiplier = 10^(decimals or 0)
|
||||||
local result = math.floor(0.5 + (n / math.pow(1000, factor)) * multiplier) / multiplier
|
local result = math.floor(0.5 + (n / math.pow(1000, factor)) * multiplier) / multiplier
|
||||||
|
Loading…
Reference in New Issue
Block a user