Skip to main content

load_filex

Function load_filex 

Source
pub fn load_filex(
    state: &mut LuaState,
    filename: Option<&[u8]>,
    mode: Option<&[u8]>,
) -> Result<i32, LuaError>
Expand description

Load a file as a Lua chunk. Returns LUA_OK on success or an error code.

PORT NOTE: PORTING.md §1 bans std::fs outside lua-cli, but C-Lua’s luaL_loadfilex is part of the auxiliary library (lauxlib.c) and is reachable from the base library (loadfile/dofile). Phase A’s stub raised an error here, which broke loadfile(missing) returning nil, err. The real C semantics push an error string onto the stack and return a non-zero status, which load_aux then converts to (nil, errmsg).