• Question about AddDir
    0 replies, posted
Hey, i've always wondered this and i'd like a quick answer from someone who knows. So if I have a script like this: [lua] local function AddDir(dir) dir = string.Replace(dir,"\\\\", "/") dir = string.Replace(dir, "\\", "/") local files, dirs = file.Find(dir.."/*", "GAME") for k, v in pairs(dirs) do AddDir(dir.."/"..v) end for k, v in pairs(files) do local realpath = dir.."/"..v if(string.find(realpath, "addons", nil, false) ~= nil) then local path_array = string.Explode("/", dir.."/"..v) table.remove(path_array, 1) table.remove(path_array, 1) realpath = string.Implode("/", path_array) end resource.AddFile(realpath) end end [/lua] and I have an addon which is called "Cake" Now inside of "Cake" there is materials and models Inside of materials there is folder1, folder2, and folder3, and inside of models there is folder1, folder2, and folder3. Inside of each folder there is a file called cake.mdl If I do [lua] AddDir("addons/Cake/models") AddDir("addons/Cake/materials") [/lua] Will players download the files in the folders folder1, folder2, and folder3, or will it just go into Cake's models folder, find nothing to download, and quit out? How does this work?
Sorry, you need to Log In to post a reply to this thread.