FileGetPath: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
m (Portuguese version indexed) |
||
(6 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server client function}} | {{Server client function}} | ||
{{New feature/item|3. | {{New feature/item|3.0153|1.5.3|7446| | ||
This function retrieves the path of the given file. | |||
}} | }} | ||
Line 9: | Line 9: | ||
string fileGetPath ( file theFile ) | string fileGetPath ( file theFile ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[file]]:getPath|path}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
Line 14: | Line 15: | ||
===Returns=== | ===Returns=== | ||
Returns a ''string'' | 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"> | ||
local newFile = fileCreate("test.txt") -- attempt to create a new file | local newFile = fileCreate("test.txt") -- attempt to create a new file | ||
if (newFile) then -- check if the creation succeeded | if (newFile) then -- check if the creation succeeded | ||
local path = fileGetPath(newFile) | local path = fileGetPath(newFile) | ||
outputChatBox("New file created at: "..path,root,0,255,0) | outputChatBox("New file created at: "..path, root, 0, 255, 0) | ||
fileClose(newFile) -- close the file once you're done with it | fileClose(newFile) -- close the file once you're done with it | ||
end | end | ||
</syntaxhighlight> | </syntaxhighlight></section> | ||
==See Also== | ==See Also== | ||
{{File functions}} | {{File functions}} | ||
[[pt-br:fileGetPath]] |
Latest revision as of 18:43, 20 December 2023
This function retrieves the path of the given file.
Syntax
string fileGetPath ( file theFile )
OOP Syntax Help! I don't understand this!
- Method: file:getPath(...)
- Variable: .path
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 1local 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