mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-26 01:03:46 +01:00
Replace math.pow by ^
This commit is contained in:
parent
2f01c5716b
commit
826c7b7aae
2
conf.lua
2
conf.lua
@ -153,7 +153,7 @@ function generate_settingtypes(default_conf, constraints)
|
||||
local range = constraints.range
|
||||
if range then
|
||||
-- TODO consider better max
|
||||
type_args = (constraints.int and "%d %d" or "%f %f"):format(range[1], range[2] or math.pow(2, 30))
|
||||
type_args = (constraints.int and "%d %d" or "%f %f"):format(range[1], range[2] or 2 ^ 30)
|
||||
end
|
||||
-- HACK
|
||||
if not default_conf then default_conf = range[1] end
|
||||
|
2
math.lua
2
math.lua
@ -39,7 +39,7 @@ function tostring(number, base, digit_function, precision)
|
||||
number = number % 1
|
||||
if number ~= 0 and number >= base ^ -precision then
|
||||
table.insert(out, ".")
|
||||
while precision >= 0 and number >= math.pow(base, precision) do
|
||||
while precision >= 0 and number >= base ^ precision do
|
||||
number = number * base
|
||||
digit = math.floor(number % base)
|
||||
table.insert(out, digit_function(digit))
|
||||
|
@ -1,4 +1,4 @@
|
||||
max_wear = math.pow(2, 16) - 1
|
||||
max_wear = 2 ^ 16 - 1
|
||||
function override(function_name, function_builder)
|
||||
local func = minetest[function_name]
|
||||
minetest["original_" .. function_name] = func
|
||||
|
4
text.lua
4
text.lua
@ -120,9 +120,9 @@ function utf8(number)
|
||||
result = string.char(128 + remainder) .. result
|
||||
number = (number - remainder) / 64
|
||||
i = i + 1
|
||||
if number <= math.pow(2, 8 - i - 2) then break end
|
||||
if number <= 2 ^ (8 - i - 2) then break end
|
||||
end
|
||||
return string.char(256 - math.pow(2, 8 - i - 1) + number) .. result
|
||||
return string.char(256 - 2 ^ (8 - i - 1) + number) .. result
|
||||
end
|
||||
|
||||
--+ deprecated
|
||||
|
Loading…
Reference in New Issue
Block a user