Modules/FileSystem/translator/rename: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ This function moves a file from a source location to a destination location inside of a filesystem. This function is the fastest way to move data from one location to another. ==Syntax== <syntaxhighlight lang="lua"> bool translator:rename ( string srcPath, string dstPath ) </syntaxhighlight> ==Arguments== *'''srcPath:''' a path to the source file *'''dstPath:''' the path to the destination location where the source file should be moved to ==Returns== This fu...")
 
No edit summary
 
Line 1: Line 1:
<pageclass class="#3c82c8" subcaption="Translator function"></pageclass>
__NOTOC__
__NOTOC__
This function moves a file from a source location to a destination location inside of a filesystem. This function is the fastest way to move data from one location to another.
This function moves a file from a source location to a destination location inside of a filesystem. This function is the fastest way to move data from one location to another.

Latest revision as of 03:27, 23 January 2022

This function moves a file from a source location to a destination location inside of a filesystem. This function is the fastest way to move data from one location to another.

Syntax

bool translator:rename ( string srcPath, string dstPath )

Arguments

  • srcPath: a path to the source file
  • dstPath: the path to the destination location where the source file should be moved to

Returns

This function returns true if the file pointed at by srcPath could be successfully moved to the new dstPath location, false otherwise.

Example

Click to collapse [-]
Client

This snippet moves a script file to another location.

-- Create a generic translator.
local resRoot = fileCreateTranslator( "/" );

-- Move this script file into a directory called "collection"
resRoot:rename( "thisScript.lua", "trash/thisScript.lua" );

FileSystem Translator Functions