Resource code help, keeps crashing


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.."/*", true)) do
		resource.AddFile(dir.."/"..v)
	end
end

AddDir("materials/entities")

Can anyone tell me why this is causing lua errors??

If you’re asking for help about lua errors why wouldn’t you post them? Please use some common sense. (This goes for everyone by the way, not just you.)

file.Find was changed you need to update the second argument to the proper format.

[editline]30th November 2012[/editline]

Whats wrong

file.FindDir is removed, use file.Find instead.

[lua]
function AddDir(dir)
local files, folders = file.Find( dir…"/*", “GAME” )
for _, fdir in pairs(folders) do
AddDir(dir…"/"…fdir)
end

for k,v in pairs(files) do
	resource.AddFile(dir.."/"..v)
end

end
[/lua]

Thanks guys

One last question, How do i get this to work? I want to hide player names in my server. Errors again.


function GM:HUDDrawTargetID()
     return false
end