Skip to main content

Module os_lib

Module os_lib 

Source
Expand description

Lua os standard library.

Ports src/loslib.c (430 lines, 12 functions) to Rust.

§Platform access limitations

Several os.* functions require OS-level capabilities. File removal, rename, command execution, environment lookup, temporary-name generation, and wall-clock access route through GlobalState hooks supplied by the embedder where needed for sandboxed/WASM hosts.

Time decomposition (os.date, os.time) requires C-library functions (gmtime_r, localtime_r, mktime, strftime). Those call sites are flagged with TODO(port) and the stubs use a zero-initialised TmFields.

Structs§

TmFields
Local mirror of C’s struct tm.

Constants§

OS_LIB
Mapping from Lua-visible names to the Rust implementations of each os.* function.

Functions§

open_os
Opens the os library: creates a new table populated with OS_LIB and leaves it on the stack.

Type Aliases§

NativeFn
Type alias for a Lua native function implementation in Rust.