FileGetPath: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(https://github.com/multitheftauto/mtasa-blue/commit/87697c4ca2d3a41c66971fe4c1cfb5b64a74f302)
 
m (fix version)
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Server client function}}
{{Server client function}}
Get file's path.
{{New feature/item|3.0153|1.5.3|7446|
This function retrieves the path of the given file.
}}


==Syntax==
==Syntax==
Line 12: Line 14:


===Returns===
===Returns===
Returns a ''string'' with the path, ''false'' if there's something wrong with the file in the argument.
Returns a ''string'' representing the file path, ''false'' if invalid file was provided.


==Example==
==Example==
 
<section name="Server Example 1" class="server" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--TODO
local newFile = fileCreate("test.txt")                -- attempt to create a new file
</syntaxhighlight>
if (newFile) then                                      -- check if the creation succeeded
    local path = fileGetPath(newFile)
    outputChatBox("New file created at: "..path, root, 0, 255, 0)
    fileClose(newFile)                                -- close the file once you're done with it
end
</syntaxhighlight></section>


==See Also==
==See Also==
{{File functions}}
{{File functions}}

Revision as of 17:16, 22 October 2016

This function retrieves the path of the given file.

Syntax

string fileGetPath ( file theFile )

Required Arguments

  • theFile: The file you want to get the path.

Returns

Returns a string representing the file path, false if invalid file was provided.

Example

Click to collapse [-]
Server Example 1
local newFile = fileCreate("test.txt")                -- attempt to create a new file
if (newFile) then                                       -- check if the creation succeeded
    local path = fileGetPath(newFile)
    outputChatBox("New file created at: "..path, root, 0, 255, 0)
    fileClose(newFile)                                -- close the file once you're done with it
end

See Also