I want to add a sound directory of all my sounds on the server, but they wont DL

I got this code from the wiki, and it won’t add directory of all sounds.
[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(“sound\p90”)[/lua]

Because it’s all on 1 line

No.
Wait what.
SHIT.

[editline]24th January 2011[/editline]

I call bullshit.

http://img88.imageshack.us/img88/2213/icallbullshit.png

Copy Pasta’ again…
[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(“sound\p90”)[/lua]

Because of the double slash here --> function AddDir(dir) // everything behind here becomes a comment. If you use Notepad++ with Lua syntax highlighter you would’ve seen it. (God i hate the keyboards at school, already made [del]7[/del] 8 typos while typing this)

[editline]24th January 2011[/editline]

Oh, use [lua] tags, not

 tags

[editline]24th January 2011[/editline]

for _, fdir should be for _,fdir


I think.

[editline]24th January 2011[/editline]

What the christ, is the Lua bbcode fucked?

Done.
Going to test.

Also, the function calls itself:
[lua]
if fdir != “.svn” then // don’t spam people with useless .svn folders
AddDir(dir…"/"…fdir)
end
[/lua]
So isn’t it creating a loop there?

[editline]24th January 2011[/editline]

Meh, gotta go to the next lesson, i’ll be checking the thread in 6h (Thats the next time i got computer acces :P)

[editline]24th January 2011[/editline]

Or wait, i just got a network phone, and check in 30 min

Goz3rr is a fucking retard. The space in between the variables in a for loop is the programmers choice.
for k,v in pairs is the exact same thing as for k, v in pairs. and if fdir != “.svn” then is NOT a loop, it is making sure that the variable fdir is not a .svn folder, if it is not then send it to the client.

Hmm, I’m not really a coder, just got the code from the wiki.

AddDir(“sound\p90”)

to

AddDir(“sound/p90”)

i have always done that way.

I’m confused, what do I do?

[editline]25th January 2011[/editline]

Holy crap, post above me fixed it.
Just changed to forward slash, and now it’s downloading.
Thanks.

NP