EMILUA(3em)
π EMILUA(3em) β Emilua reference, but make it cute π§
okay so bestie, welcome to the EMILUA(3em) page. This is the Emilua manual, and we are gonna read it together like a group chat. π
πΈ NAME πΈ
Emilua β Lua execution engine. β¨
β¨ FUNCTIONS β¨
π new() β file.random_access
new() (1)
new(fd: file_descriptor) (2)
- Default constructor.
- Converts a
file_descriptorinto afile.random_accessobject.
π open(self, path: filesystem.path, flags: string[])
Open the file using the specified path. π«Ά
flags may contain:
"append"β Open the file in append mode."create"β Create the file if it does not exist."exclusive"β Ensure a new file is created. Must be combined withcreate."read_only"β Open the file for reading."read_write"β Open the file for reading and writing."sync_all_on_write"β Open the file so that write operations automatically synchronise the file data and metadata to disk (FILE_FLAG_WRITE_THROUGH/O_SYNC)."truncate"β Open the file with any existing contents truncated."write_only"β Open the file for writing.
π close(self)
Close the file.
Forward the call to the Boost.Asio function with the same name at https://www.boost.org/doc/libs/1_78_0/doc/html/boost_asio/reference/basic_random_access_file/close/overload2.html:
βAny asynchronous read or write operations will be cancelled immediately, and will complete with the boost::asio::error::operation_aborted error.β
π¦ cancel(self)
Cancel all asynchronous operations associated with the file.
Forward the call to the Boost.Asio function with the same name at https://www.boost.org/doc/libs/1_78_0/doc/html/boost_asio/reference/basic_random_access_file/cancel/overload2.html:
βThis function causes all outstanding asynchronous read and write operations to finish immediately, and the handlers for cancelled operations will be passed the boost::asio::error::operation_aborted error.β
π assign(self, fd: file_descriptor)
Assign an existing native file to self. π
π release(self) β file_descriptor
Release ownership of the native descriptor implementation.
Forward the call to the Boost.Asio function with the same name at https://www.boost.org/doc/libs/1_78_0/doc/html/boost_asio/reference/basic_random_access_file/release/overload2.html:
βThis function causes all outstanding asynchronous read and write operations to finish immediately, and the handlers for cancelled operations will be passed the boost::asio::error::operation_aborted error. Ownership of the native file is then transferred to the caller.β
π resize(self, n: integer)
Alter the size of the file.
This function resizes the file to the specified size, in bytes. If the current file size exceeds n then any extra data is discarded. If the current size is less than n then the file is extended and filled with zeroes. β¨
π₯ lock(self)
Acquires an exclusive advisory lock on the file.
See flock(2).
Note: Not available on Windows. π
πΈ lock_shared(self)
Acquires a shared advisory lock on the file.
See flock(2).
Note: Not available on Windows. π
π try_lock(self) β boolean
Tries to acquire an exclusive advisory lock on the file. Returns whether lock acquisition was successful.
See flock(2).
Note: The current fiber is never suspended. π΄
Note: Not available on Windows. π
π§ try_lock_shared(self) β boolean
Tries to acquire a shared advisory lock on the file. Returns whether lock acquisition was successful.
See flock(2).
Note: The current fiber is never suspended. π΄
Note: Not available on Windows. π
π« unlock(self)
Releases an existing advisory lock on the file held by this process.
See flock(2).
Note: The current fiber is never suspended. π΄
Note: Not available on Windows. π
β read_some_at(self, offset: integer, buffer: byte_span) β integer
Read data from the file at the specified offset and blocks current fiber until it completes or errs.
Returns the number of bytes read.
Important: Lua conventions on index starting at 1 are ignored. Indexes here are OS-mandated and start at 0. π«Ά
π write_some_at(self, offset: integer, buffer: byte_span) β integer
Write data to the file at the specified point and blocks current fiber until it completes or errs.
Returns the number of bytes written.
Important: Lua conventions on index starting at 1 are ignored. Indexes here are OS-mandated and start at 0. π«Ά
π PROPERTIES π
πΌ is_open: boolean
Whether the file is open.
πΌ size: integer
The size of the file.
π thatβs the whole page, bestie. This is from Emilua 0.12.1-nixpkgs1, dated 1980-01-01. mwah πβ¨
π¦ where this page comes from
- nixos 26.05: emilua 0.12.1
- nixpkgs unstable: emilua 0.12.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms