Filesystem
Astra provides some Filesystem functionality to help extend the standard library. Some of the common ones are as follows:
get_metadataread_dirget_current_dirget_script_pathget_separatorchange_direxistscreate_dircreate_dir_allremoveremove_dirremove_dir_all
They are fairly self explanitory and does not require further details. Example usage:
local fs = require("fs")
pprint(fs.get_script_path())
The Filesystem also supports buffers and buffered read and write of files as well.
-- Begin with creating a buffer with capacity of 10 bytes
local buffer = fs.new_buffer(10)
-- Then open a file to do operations on
local file = fs.open("myfile.txt")
-- You can read the contents
file:read(buffer)
-- Or write
file:write(buffer)
There are variations of them as well. Here is the full list:
readread_bufferread_exactwritewrite_buffer