diff --git a/crates/lune-std-process/src/lib.rs b/crates/lune-std-process/src/lib.rs index b66bc0df..390f75dc 100644 --- a/crates/lune-std-process/src/lib.rs +++ b/crates/lune-std-process/src/lib.rs @@ -50,6 +50,11 @@ pub fn module(lua: &Lua) -> LuaResult { // Create constants for OS & processor architecture let os = lua.create_string(OS.to_lowercase())?; let arch = lua.create_string(ARCH.to_lowercase())?; + let endianness = lua.create_string(if cfg!(target_endian = "big") { + "big" + } else { + "little" + })?; // Create readonly args array let args_vec = lua .app_data_ref::>() @@ -75,6 +80,7 @@ pub fn module(lua: &Lua) -> LuaResult { TableBuilder::new(lua)? .with_value("os", os)? .with_value("arch", arch)? + .with_value("endianness", endianness)? .with_value("args", args_tab)? .with_value("cwd", cwd_str)? .with_value("env", env_tab)? diff --git a/types/process.luau b/types/process.luau index 6a4a12ec..9c436008 100644 --- a/types/process.luau +++ b/types/process.luau @@ -1,5 +1,6 @@ export type OS = "linux" | "macos" | "windows" export type Arch = "x86_64" | "aarch64" +export type Endianness = "big" | "little" export type SpawnOptionsStdioKind = "default" | "inherit" | "forward" | "none" export type SpawnOptionsStdio = { @@ -117,8 +118,8 @@ export type ChildProcess = { stdin: typeof(ChildProcessWriter), stdout: typeof(ChildProcessReader), stderr: typeof(ChildProcessReader), - kill: () -> (); - status: () -> { ok: boolean, code: number } + kill: () -> (), + status: () -> { ok: boolean, code: number }, } --[=[ @@ -222,6 +223,20 @@ process.os = (nil :: any) :: OS ]=] process.arch = (nil :: any) :: Arch +--[=[ + @within Process + @prop endianness Endianness + @tag read_only + + The endianness of the processor currently being used. + + Possible values: + + * `"big"` + * `"little"` +]=] +process.endianness = (nil :: any) :: Endianness + --[=[ @within Process @prop args { string }