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
|
@ -39,6 +39,14 @@ function vector.round(v)
|
|||
}
|
||||
end
|
||||
|
||||
function vector.apply(v, func)
|
||||
return {
|
||||
x = func(v.x),
|
||||
y = func(v.y),
|
||||
z = func(v.z)
|
||||
}
|
||||
end
|
||||
|
||||
function vector.distance(a, b)
|
||||
local x = a.x - b.x
|
||||
local y = a.y - b.y
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue