mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-06 17:41:04 +00:00
Add Lua helper functions vector.apply(v) math.sign(x, tolerance)
This commit is contained in:
parent
0e78aa296e
commit
2fd14e1bd5
3 changed files with 23 additions and 0 deletions
|
@ -212,6 +212,17 @@ function math.hypot(x, y)
|
|||
return x * math.sqrt(1 + t * t)
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function math.sign(x, tolerance)
|
||||
tolerance = tolerance or 0
|
||||
if x > tolerance then
|
||||
return 1
|
||||
elseif x < -tolerance then
|
||||
return -1
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function get_last_folder(text,count)
|
||||
local parts = text:split(DIR_DELIM)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue