-
Notifications
You must be signed in to change notification settings - Fork 20
file_object
local file = require('file')
local file_object = file.new(path)
File objects are used as proxies to check paths, read from files and write to files.
A file object contains the following functions:
- file_object:exists : Checks if the file exists
- file_object:read : Reads the contents of a file
- file_object:write : Writes to the file
- file_object:log : Appends a line to the file
Checks whether or not the file exists.
function file_object:exists() : boolean
exists boolean
true
if the path of the file object exists,false
otherwise.
Reads the contents of a file. Errors if the file does not exist or is inaccessible.
function file_object:read() : string
contents string
The full contents of the file as a string.
Writes the provided string to the file. If the file does not exist yet it will be created. If it does exist it will be fully overwritten.
function file_object:write(content : string)
content string
The string to write to the file. May be a binary string, but non-string types will not be converted and will error.
This function does not return any values.
Writes the provided string to the file and appends a new line at the end. If the file does not exist yet it will be created. If it does exist it the new string and the new line will be appended.
function file_object:log(content : string)
content string
The string to write to the file. May be a binary string, but non-string types will not be converted and will error.
This function does not return any values.
- Background and Architecture
- Windower Data Locations
- Code Standards and Guidelines
- Addon Development
- Windower Commands
- Packet Tutorial
- burdometer
- config
- delay_me_not
- distance
- dress_up
- enternity
- fps
- ime
- logger
- party_time
- paste
- pouches
- send
- shortcuts
- speedometer
- target_info
- terminate
- timestamp
- window_title
- Game
- Windower
- General