FileGetPath: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (Little mistake)
mNo edit summary
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Server client function}}
{{Server client function}}
{{Needs Example}}
{{New feature/item|3.0160|1.6|7446|
{{New feature/item|3.0160|1.6|7446|
Use this function to get file's path.
Use this function to get file's path.
Line 20: Line 19:


<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--TODO
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
</syntaxhighlight>
</syntaxhighlight>


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

Revision as of 14:00, 30 October 2015

Use this function to get file's path.

Syntax

string fileGetPath ( file theFile )

Required Arguments

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

Returns

Returns a string with the path, false if there's something wrong with the file in the argument.

Example

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