MTA:Eir/FileSystem/translator/stat

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

This function queries common information about a filesystem object and returns it as a dictionary. Example of its return value:

{
    accessTime = 1390997951, -- OS specific time information
    creationTime = 1381999749, -- OS specific time information
    modTime = 1381872826, -- OS specific time information
    size = 1441280, -- size of the filesystem object in bytes
};

Syntax

dictionary translator:stat ( string filePath )

Arguments

  • filePath: the path to the filesystem object that you want to get the statistics of

Returns

This function returns a statistics structure of the filesystem object pointed at by filePath, false if filePath is not a valid path in the translator or the filesystem object pointed at by it is not accessible.

Example

Click to collapse [-]
Client

This snippet returns information about the currently running script. It can be used to know when the script has been updated by MTA.

-- Grab a generic translator of resource instance directory.
local resRoot = fileCreateTranslator( "/" );

-- Get the information of this script file.
local scriptStats = resRoot:stat( "thisScript.lua" );

-- todo: use this information somehow.

FileSystem Translator Functions