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 that are restricted to lua-cli per PORTING.md (no std::fs, no std::process in lua-stdlib). Those functions are stubbed with TODO(port) markers and return nil / error until a capability-injection layer is designed in Phase B.

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.