GMOD_disease/lua/autorun/server/sv_utils.lua

28 lines
543 B
Lua
Raw Normal View History

2023-09-03 14:04:49 -04:00
utils = {}
function utils.split (str, sep)
local new_table = {}
for v in string.gmatch(str, "([^"..sep.."]+)") do
table.insert(new_table, v)
end
return new_table
end
2023-09-03 15:40:13 -04:00
function utils.path_create(path)
local dirs = utils.split(path, "/")
table.remove(dirs)
local tmp = "";
for i, dir in ipairs(dirs) do
tmp = tmp .. dir
print(tmp)
if not file.Exists(tmp, "DATA")
then
file.CreateDir(tmp)
end
tmp = tmp .. "/"
end
end
2023-09-03 14:04:49 -04:00
return utils