string.trim(s) is deprecated. Removed some spaces tabulations

This commit is contained in:
yago 2015-02-28 14:53:39 +01:00
parent dab0c97bb6
commit 9eb136b734

View File

@ -33,11 +33,17 @@ function string:split(sep)
return fields return fields
end end
-- Removes spaces -- DEPRECATED
function string.trim(s) function string.trim(s)
print("string.trim(s) is DEPRECATED use string:trim() instead")
return s:gsub("^%s*(.-)%s*$", "%1") return s:gsub("^%s*(.-)%s*$", "%1")
end end
-- Removes spaces
function string:trim()
return self:gsub("^%s*(.-)%s*$", "%1")
end
function get_http_file_name(url, headers) function get_http_file_name(url, headers)
-- Everything after the last / -- Everything after the last /
local file_name = url:match("([^/]+)$") local file_name = url:match("([^/]+)$")
@ -153,6 +159,7 @@ function run_command(str)
return result return result
end end
-- User has priviledges
function is_sudo(msg) function is_sudo(msg)
local var = false local var = false
-- Check users id in config -- Check users id in config
@ -220,7 +227,7 @@ end
-- DEPRECATED!!!!! -- DEPRECATED!!!!!
function string.starts(String, Start) function string.starts(String, Start)
print "string.starts(String, Start) is DEPRECATED use string:starts(text) instead" print("string.starts(String, Start) is DEPRECATED use string:starts(text) instead")
return Start == string.sub(String,1,string.len(Start)) return Start == string.sub(String,1,string.len(Start))
end end