Can resource.addfile be used in a do loop?

I tried it and it didn’t work. but it makes little sense that it wouldn’t



	for key, v in pairs(file.Find("sound/gmmp/*", "GAME")) do
	    resource.AddFile( "sound/gmmp/" .. v )
		print( "sound/gmmp/" .. v )
	end


this is what is printed in server console:
sound/gmmp/ATO.mp3
sound/gmmp/Avicii - Hey Brother.mp3
sound/gmmp/DJ Snake and Lil Jon - Turn Down for What.mp3
sound/gmmp/Electro - Black Tiger Sex Machine.mp3
sound/gmmp/MACKLEMORE and RYAN LEWIS - CAN’T HOLD US FEAT. RAY DALTON.mp3
sound/gmmp/Martin Garrix - Animals.mp3
sound/gmmp/Savior of the Slamming Jam.mp3
sound/gmmp/Sonreal - Everywhere We Go.mp3
sound/gmmp/Summer - Calvin Harris.mp3
sound/gmmp/cantstop.mp3
sound/gmmp/daydreamer.mp3
sound/gmmp/freedom.mp3
sound/gmmp/splittingcolors.mp3
sound/gmmp/tearsinrain.mp3

That should work; does it work with all of the lines actually resource.AddFile’d separately?

yes

Yeah, it can be. One thing though; I’d recommend you rename all of those files… Replace spaces with _, replace uppercase letters with lowercase. People running Linux will have issues with the sounds as Linux treats a capital letter as a different character altogether than the lower-case. ( 32 apart anyways so… ). Remove hyphens ( - ) and any other “special” characters as there may be additional issues with the engine not being able to read it because the string is parsed before it tries the file…

Yea it is special characters. I was testing “MACKLEMORE and RYAN LEWIS - CAN’T HOLD US FEAT. RAY DALTON.mp3” and I can tell the “FEAT.” is confusing it as an extension.

All good now.