77
78
79
80
81
82
83
84
85
86
87
88
89
90
...
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
return string.format("%s%s%s",
vd, (full and (' ' .. pmin) or smin), unitForAmt(vd))
end
end
end
end
return string.format("%s%s", val, unitForAmt(val))
end
function fn.siUI(u,v,f,us,...) return fn.si(u,v,f,us,2,...) end
function fn.lerp(t, a, b) return (1-t)*a + t*b end
function fn.gradient(grad, pos)
local n = #grad
................................................................................
end;
}
-- function fn.vlerp
function fn.timespec(n)
if n == 0 then return '0s' end
if n < 0 then return '-' .. fn.timespec(n*-1) end
local sec = math.floor(n % 60)
local min = math.floor(n / 60)
local hr = math.floor(min / 60)
min = min % 60
local spec = {}
if hr ~= 0 then table.insert(spec, string.format("%shr", hr)) end
if min ~= 0 then table.insert(spec, string.format("%sm", min)) end
if sec ~= 0 then table.insert(spec, string.format("%ss", sec)) end
return table.concat(spec, ' ')
end
return fn
|
|
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
...
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
return string.format("%s%s%s",
vd, (full and (' ' .. pmin) or smin), unitForAmt(vd))
end
end
end
end
if prec then val = lib.math.trim(val,prec) end
return string.format("%s%s", val, unitForAmt(val))
end
function fn.siUI(u,v,f,us,...) return fn.si(u,v,f,us,2,...) end
function fn.lerp(t, a, b) return (1-t)*a + t*b end
function fn.gradient(grad, pos)
local n = #grad
................................................................................
end;
}
-- function fn.vlerp
function fn.timespec(n)
if n == 0 then return '0s' end
if n < 0 then return '-' .. fn.timespec(n*-1) end
if n < 1 then return fn.siUI('s', n) end
local sec = math.floor(n % 60)
local min = math.floor(n / 60)
local hr = math.floor(min / 60)
min = min % 60
local spec = {}
if hr ~= 0 then table.insert(spec, string.format("%shr", hr)) end
if min ~= 0 then table.insert(spec, string.format("%sm", min)) end
if sec ~= 0 then table.insert(spec, string.format("%ss", sec)) end
return table.concat(spec, ' ')
end
return fn
|