• Resource addir?
    2 replies, posted
Now we all know the good old resource.addfile, but, im quite sure i found a thread where another method was mentioned, where you could add a directory instead of every single file by them selves, anyone remember this way? (I suck at explainin' stuff <.<)
[lua] function AddDir(dir) // recursively adds everything in a directory to be downloaded by client local list = file.FindDir("../"..dir.."/*") for _, fdir in pairs(list) do if fdir != ".svn" then // don't spam people with useless .svn folders AddDir(dir.."/"..fdir) end end for k,v in pairs(file.Find("../"..dir.."/*")) do resource.AddFile(dir.."/"..v) end end AddDir("models/yourmodels") [/lua] Taken directly from the wiki. [url]http://wiki.garrysmod.com/?title=Resource.AddFile[/url]
[QUOTE=Tehelee;21647056][lua] function AddDir(dir) // recursively adds everything in a directory to be downloaded by client local list = file.FindDir("../"..dir.."/*") for _, fdir in pairs(list) do if fdir != ".svn" then // don't spam people with useless .svn folders AddDir(dir.."/"..fdir) end end for k,v in pairs(file.Find("../"..dir.."/*")) do resource.AddFile(dir.."/"..v) end end AddDir("models/yourmodels") [/lua] Taken directly from the wiki. [url]http://wiki.garrysmod.com/?title=Resource.AddFile[/url][/QUOTE] Thanks, i had already found that page, i wonder how the heck i missed that O_o
Sorry, you need to Log In to post a reply to this thread.