Modules/FileSystem/translator/stat

From Multi Theft Auto: Wiki
Jump to navigation Jump to search

This function queries common information about a filesystem object and returns it as a dictionary. Example of it's 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