removed trash
This commit is contained in:
parent
f9c3ec66be
commit
871f9a4880
@ -1,11 +0,0 @@
|
||||
function math.Rand( low, high )
|
||||
return low + (high - low) * math.random()
|
||||
end
|
||||
|
||||
function math.Clamp( _in, low, high )
|
||||
return math.min(math.max( _in, low ), high)
|
||||
end
|
||||
|
||||
function math.Lerp(frac, from, to)
|
||||
return from + (to - from) * frac
|
||||
end
|
||||
@ -1,65 +0,0 @@
|
||||
function string.FormattedTime(seconds, format ) -- from gmod
|
||||
if not seconds then seconds = 0 end
|
||||
|
||||
local hours = math.floor(seconds / 3600)
|
||||
local minutes = math.floor((seconds / 60) % 60)
|
||||
local millisecs = (seconds - math.floor(seconds)) * 100
|
||||
seconds = math.floor(seconds % 60)
|
||||
|
||||
if format then
|
||||
return string.format(format, minutes, seconds, millisecs)
|
||||
else
|
||||
return {h = hours, m = minutes, s = seconds, ms = millisecs}
|
||||
end
|
||||
end
|
||||
|
||||
function string.Left(str, num) return string.sub(str, 1, num) end
|
||||
function string.Right(str, num) return string.sub(str, -num) end
|
||||
|
||||
function string.Replace(str, tofind, toreplace)
|
||||
local tbl = string.Explode(tofind, str)
|
||||
if (tbl[1]) then return table.concat(tbl, toreplace) end
|
||||
return str
|
||||
end
|
||||
|
||||
local totable = string.ToTable
|
||||
local string_sub = string.sub
|
||||
local string_find = string.find
|
||||
local string_len = string.len
|
||||
function string.Explode(separator, str, withpattern)
|
||||
if (separator == "") then return totable(str) end
|
||||
if (withpattern == nil) then withpattern = false end
|
||||
|
||||
local ret = {}
|
||||
local current_pos = 1
|
||||
|
||||
for i = 1, string_len(str) do
|
||||
local start_pos, end_pos = string_find(str, separator, current_pos, not withpattern)
|
||||
if (not start_pos) then break end
|
||||
ret[i] = string_sub(str, current_pos, start_pos - 1)
|
||||
current_pos = end_pos + 1
|
||||
end
|
||||
|
||||
ret[#ret + 1] = string_sub(str, current_pos)
|
||||
|
||||
return ret
|
||||
end
|
||||
|
||||
function string.Split( str, delimiter )
|
||||
return string.Explode( delimiter, str )
|
||||
end
|
||||
|
||||
function string.Trim(s, char)
|
||||
if char then char = string.PatternSafe(char) else char = "%s" end
|
||||
return string.match(s, "^" .. char .. "*(.-)" .. char .. "*$") or s
|
||||
end
|
||||
|
||||
function string.TrimRight(s, char)
|
||||
if char then char = string.PatternSafe(char) else char = "%s" end
|
||||
return string.match(s, "^(.-)" .. char .. "*$") or s
|
||||
end
|
||||
|
||||
function string.TrimLeft(s, char)
|
||||
if char then char = string.PatternSafe(char) else char = "%s" end
|
||||
return string.match(s, "^" .. char .. "*(.+)$") or s
|
||||
end
|
||||
@ -1,17 +0,0 @@
|
||||
function table.Copy(t)
|
||||
local newT = {}
|
||||
for k, v in pairs(t) do
|
||||
newT[k] = v
|
||||
end
|
||||
return newT
|
||||
end
|
||||
|
||||
function table.Random(t)
|
||||
local randomT = {}
|
||||
for k, v in pairs(t) do randomT[#randomT + 1] = {k, v} end
|
||||
|
||||
local var = randomT[math.random(1, #randomT)]
|
||||
local key, value = var[1], var[2]
|
||||
|
||||
return value, key
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user