MTA:Eir/FileSystem/translator/absPath: Difference between revisions
Jump to navigation
Jump to search
(Created page with "__NOTOC__ This function resolves a specified path into its absolute version. This function can be used to get a unique version of a path (without scripting symbols such as '..')....") |
mNo edit summary |
||
Line 4: | Line 4: | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
string translator | string translator:absPath ( string path ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 18: | Line 18: | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- Get the absolute path to our resource. | -- Get the absolute path to our resource. | ||
local absResourceLocation = fileCreateTranslator( "/" ) | local absResourceLocation = fileCreateTranslator( "/" ):absPath(); | ||
-- Print it out to the user. | -- Print it out to the user. |
Revision as of 23:27, 16 January 2022
This function resolves a specified path into its absolute version. This function can be used to get a unique version of a path (without scripting symbols such as '..').
Syntax
string translator:absPath ( string path )
Arguments
- path: the path that should be resolved into a absolute path; can be nil to return the absolute location of the current directory.
Returns
This function returns the absolute version of the path that is passed to it, false if the specified path is not accessible by the translator.
Example
Click to collapse [-]
ClientThis snippet prints the absolute location of the shared client-side resource folder.
-- Get the absolute path to our resource. local absResourceLocation = fileCreateTranslator( "/" ):absPath(); -- Print it out to the user. outputChatBox( "running resource from: " .. absResourceLocation );