EMILUA(3em)

πŸ“¦ version 0.12.1, in nixos 26.05, nixpkgs unstable

πŸ’… 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)
  1. Default constructor.
  2. Converts a file_descriptor into a file.random_access object.

🐚 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 with create.
  • "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