file.TFind

From GMod Wiki

Revision as of 12:29, 10 June 2011 by Wizard (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Function
Syntax file.TFind( String Filename/Directory, Function Function )
Where is this used?
Description:
Finds a list of files and folders within a directory and calls the provided callback function with the arguments:
Directory you searched String , Table of folders Table :String , Table of filenames Table :String
Returns: nil
Part of Library: File
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=File.TFind]File.TFind [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Example

DescriptionPrints the results of TFind in the Lua folder to the console.
Used onNewerShared.png
Code
 
function TFindExample(Search, Folders, Files)
 
	print(Search) //This is where we asked it to look for files and folders. In this case: lua/*
 
	PrintTable(Folders) //Folders found. In this case you can expect to find folders such as "entities", "weapons" and "autorun".
 
	PrintTable(Files) //Files found. You'd probably end up with some .lua files :P
 
end
file.TFind("lua/*", TFindExample)
 
OutputN/A


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox