Modules/FileSystem/translator/stat: Difference between revisions
Jump to navigation
Jump to search
(Created page with "__NOTOC__ This function queries common information about a filesystem object and returns it as a dictionary. Example of its return value: <syntaxhighlight lang="lua"> { 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 }; </syntaxhighlight> ==Syntax== <syntaxhighlight lang="lua">...") |
No edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
<pageclass class="#3c82c8" subcaption="Translator function"></pageclass> | |||
__NOTOC__ | __NOTOC__ | ||
This function queries common information about a filesystem object and returns it as a dictionary. Example of | This function queries common information about a filesystem object and returns it as a dictionary. Example of it's return value: | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
{ | { |
Latest revision as of 03:27, 23 January 2022
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 [-]
ClientThis 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.