PathIsFile

From Multi Theft Auto: Wiki
Revision as of 16:43, 10 June 2024 by Fernando187 (talk | contribs) (Fix function return type from table to bool)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

BETA: NEW FEATURE (BUILD: 1.6.0 r22470)
Checks if a specified path points to a file.

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 [-]
Shared

This 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