-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtools.lua
47 lines (40 loc) · 967 Bytes
/
tools.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
showdebug = false
debug = {}
function printdebug()
local out = ""
for k,v in pairs(debug) do
if type(v) == "table" or type(v) == "userdata" then
out = out .. (k .. ": " .. type(v)) .. "\n"
else
out = out .. (k .. ": " .. tostring(v)) .. "\n"
end
end
return out
end
function math.mid(a, b, c)
if a > b then
if b > c then return b
elseif a > c then return c
else return a end
else
if a > c then return a
elseif b > c then return c
else return b end
end
end
function table.find(t, o)
for i, v in ipairs(t) do
if v == o then
return i
end
end
end
function table.removevalue(t, o)
table.remove(t, table.find(t, o))
end
function qerp(current, target, dt, ease)
if math.abs(current - target) < 0.01 then
return target
end
return current + dt * (target - current) * (ease or 5)
end