forked from nyyr/ArcHUD3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUtils.lua
More file actions
35 lines (33 loc) · 699 Bytes
/
Utils.lua
File metadata and controls
35 lines (33 loc) · 699 Bytes
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
function ArcHUD:SplitString(s,p,n)
local l,sp,ep = {},0
while(sp) do
sp,ep=strfind(s,p)
if(sp) then
tinsert(l,strsub(s,1,sp-1))
s=strsub(s,ep+1)
else
tinsert(l,s)
break
end
if(n) then n=n-1 end
if(n and (n==0)) then tinsert(l,s) break end
end
return unpack(l)
end
function ArcHUD:strcap(str)
return strupper(strsub(str, 1, 1)) .. strlower(strsub(str, 2))
end
-- Friendly/formatted int
function ArcHUD:fint(i)
if (type(i) == "number") then
if (i >= 1000000) then
return string.format("%.1fM", i/1000000)
elseif (i >= 100000) then
return string.format("%.1fk", i/1000)
else
return i
end
else
return i
end
end