From 6903367c292aecb11a330fa3a320f4747bbd2883 Mon Sep 17 00:00:00 2001 From: qwreey Date: Thu, 24 Oct 2024 01:13:06 +0000 Subject: [PATCH] Add process.endianness (#267) --- crates/lune-std-process/src/lib.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/lune-std-process/src/lib.rs b/crates/lune-std-process/src/lib.rs index b66bc0d..390f75d 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)?