MTA:Eir/FileSystem/translator/rename

From Multi Theft Auto: Wiki
Revision as of 23:24, 16 January 2022 by Quiret (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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