file.Find

From GMod Wiki

Jump to: navigation, search
Function
Syntax file.Find( String filename, [ Boolean usebasefolder ] )
Where is this used?
Description:
Find a list of files within a directory
Returns: Table : String Filenames
Part of Library: File
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=File.Find]File.Find [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionThis example lists all of the text files in the my_mod directory
Used onNewerShared.png
Code
local list = file.Find("my_mod/*.txt")
for _, f in pairs(list) do
   Msg( f )
end
 
OutputN/A


Additional Notes

 
MsgAll(file.Find("random/stuff.txt")[1])
//Output: stuff.txt
 
MsgAll(file.Find("random/*")[1])
//Output: stuff.txt
 
MsgAll(file.Find("random/*.txt")[1])
//Output: stuff.txt
 

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox