mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-16 18:01:40 +00:00
Add math.round
and fix vector.round
(#10803)
This commit is contained in:
parent
1e4913cd76
commit
3560691c0a
4 changed files with 16 additions and 4 deletions
|
@ -244,6 +244,15 @@ function math.factorial(x)
|
|||
return v
|
||||
end
|
||||
|
||||
|
||||
function math.round(x)
|
||||
if x >= 0 then
|
||||
return math.floor(x + 0.5)
|
||||
end
|
||||
return math.ceil(x - 0.5)
|
||||
end
|
||||
|
||||
|
||||
function core.formspec_escape(text)
|
||||
if text ~= nil then
|
||||
text = string.gsub(text,"\\","\\\\")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue