Is the function file.TFind broken for anyone else?

While working on my hat maker designer, I encountered a problem. While using the DTree panel, I tried to make the panel use its internal ability to list files and folders dynamically. I tried this out, but no matter what I gave the panel for the directory, it wouldn’t add any files. I got fed up with blindly trying to use this feature, so I went into the DTree Lua code, and discovered it uses a function file.TFind to thread file.Find so it doesn’t stop the entire game to find the many, many files I’m searching for (models). I decided to go to the wiki to find an example of file.TFind. Even after throwing the example for file.TFind into a Lua file and loading it, it would still not call the callback under any circumstances. Has someone found a fix for this, or should we flap our arms in the air and cry Garry as usual?

file.TFind isn’t threaded (afaik), it just starts in the garrysmod directory rather than garrysmod/data


Apparently it takes a function as second argument, which it passes the results to.

Ok, look. Why would garry make a function called file.TFind to make it start in the garrysmod folder? Why would it take a function as a callback if it wasn’t threaded? Why would it be called file.TFind if the T didn’t stand for Threaded? What would the T stand for, toast? Why do we need a file function that finds files related to toast? Why would it not call a callback at all? Why does more than one person that I’ve talked to try to use DTree’s built in file functions and have it not work at all?

Also, to all the people who rated me dumb because:

A. They didn’t understand my post
B. The post was too long to read
C. Someone rated me dumb so everyone else rated me dumb
D. I brought garry down to the level of human instead of god
E. It said something different in the wiki

need to leave this board entirely.

I completely agree with this.

The spawnmenu uses it and it works fine. This is what I use now in PAC and it works fine:

file.TFind( “data/”…folder…"*", function( f, directories, files )

for i, foldername in pairs( directories ) do
	self:AddFolder( node:AddNode( foldername ), folder..foldername.."/" );

for i, filename in pairs( files ) do
	local filenode		= node:AddNode( filename );
	filenode.FileName	= folder..filename;
	filenode.DoClick	= function( ) self.EditEntry:SetValue( filenode.FileName ); end

end );

Well, geez! Sorry for trying to help:saddowns:

My post wasn’t directed towards you, my post was directed to all of the people who simply refused to help and just rated me dumb instead. Sorry if you took it that way :sun:


Ok, I went back and it seems to work fine now. All I know is multiple people that I asked had the function stop working entirely on their machine, so I don’t feel comfortable using it.

Oh, so everybody’s happy then:sun:

Lua scripting post of the year :sun:

I concur. :sun:

Pretty much just tree (file.T(ree)Find) It starts in garrysmod for a reason, it’s the “MOD” root. (Via SDK.)

(User was banned for this post ("Annoying high-res emoticon" - SteveUK))

Good thing you posted that giant emote because I didn’t believe you the first time.