PathIsFile: Difference between revisions
Jump to navigation
Jump to search
(Created page with "__NOTOC__ {{Shared function}} {{Added feature/item|1.6.1|1.6.0|22470|Checks if a specified path points to a file.}} ==Syntax== <syntaxhighlight lang="lua"> table pathIsFile ( string path ) </syntaxhighlight> {{OOP||path:isFile}} ===Required Arguments=== *'''path:''' A string containing a path you want to check against ===Returns=== Returns '''true''' if the path points to a file, '''false''' otherwise. ==Example== <section name="Share...") |
Fernando187 (talk | contribs) m (Fix function return type from table to bool) |
||
Line 6: | Line 6: | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool pathIsFile ( string path ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[path]]:isFile}} | {{OOP||[[path]]:isFile}} |
Latest revision as of 16:43, 10 June 2024
Syntax
bool pathIsFile ( string path )
OOP Syntax Help! I don't understand this!
- Method: path:isFile(...)
Required Arguments
- path: A string containing a path you want to check against
Returns
Returns true if the path points to a file, false otherwise.
Example
Click to collapse [-]
SharedThis example lists all files in a directory
local files = {} for _,entry in ipairs(pathListDir('.')) do if pathIsFile(entry) then table.insert(files, entry) end end iprint('Files:') for _,file in ipairs(files) do iprint(' - '..file) end
See Also