fs.attributes
The function will return a table with this content:
isDir: If the path is a directory
size: The size of the path (Same as fs.getSize)
created: The time, the path was created
modification: The time, the path was modified
  | 
  |||
| Print the attributes of /test. | |||
| Code | tAttr = fs.attributes("/test")
if tAttr["isDir"] then
    print("/test" is a directory")
else:
    print("/test is a file")
print("The size of /test is " .. tAttr["size"] .. " Bytes")
print("/test was created at " .. tAttr["created"])
print("/test was modified at " .. tAttr["modification"])
 | 
    ||
| Output | It will print all attributes of a /test. | ||
Functions  | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Lua | 
  | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| CC:Tweaked | 
  | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fs.attributes Function  | |
|---|---|
| 
Syntax fs.attributes( 
  | |
| Returns | table attributes | 
| API | fs | 
| Source | CC:Tweaked (source) | 
Get the Attributes of a File or Directory.
    This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.