diff --git a/mlua-sys/Cargo.toml b/mlua-sys/Cargo.toml index d52c419..d85ea96 100644 --- a/mlua-sys/Cargo.toml +++ b/mlua-sys/Cargo.toml @@ -40,7 +40,7 @@ cfg-if = "1.0" pkg-config = "0.3.17" lua-src = { version = ">= 547.0.0, < 547.1.0", optional = true } luajit-src = { version = ">= 210.5.0, < 210.6.0", optional = true } -luau0-src = { git = "https://github.com/mlua-rs/luau-src-rs", rev = "37e1e34", optional = true } +luau0-src = { git = "https://github.com/mlua-rs/luau-src-rs", rev = "dc1102e", optional = true } [lints.rust] unexpected_cfgs = { level = "allow", check-cfg = ['cfg(raw_dylib)'] } diff --git a/mlua-sys/src/luau/lauxlib.rs b/mlua-sys/src/luau/lauxlib.rs index ddedb2c..845bb28 100644 --- a/mlua-sys/src/luau/lauxlib.rs +++ b/mlua-sys/src/luau/lauxlib.rs @@ -71,10 +71,17 @@ extern "C-unwind" { pub fn luaL_newstate() -> *mut lua_State; - // TODO: luaL_findtable + pub fn luaL_findtable( + L: *mut lua_State, + idx: c_int, + fname: *const c_char, + szhint: c_int, + ) -> *const c_char; pub fn luaL_typename(L: *mut lua_State, idx: c_int) -> *const c_char; + pub fn luaL_callyieldable(L: *mut lua_State, nargs: c_int, nresults: c_int) -> c_int; + // sandbox libraries and globals #[link_name = "luaL_sandbox"] pub fn luaL_sandbox_(L: *mut lua_State); diff --git a/mlua-sys/src/luau/luarequire.rs b/mlua-sys/src/luau/luarequire.rs index 0061307..64b1a2f 100644 --- a/mlua-sys/src/luau/luarequire.rs +++ b/mlua-sys/src/luau/luarequire.rs @@ -104,6 +104,7 @@ pub struct luarequire_Configuration { pub load: unsafe extern "C-unwind" fn( L: *mut lua_State, ctx: *mut c_void, + path: *const c_char, chunkname: *const c_char, contents: *const c_char, ) -> c_int, @@ -114,7 +115,7 @@ pub type luarequire_Configuration_init = unsafe extern "C" fn(config: *mut luare extern "C-unwind" { // Initializes and pushes the require closure onto the stack without registration. - pub fn lua_pushrequire( + pub fn luarequire_pushrequire( L: *mut lua_State, config_init: luarequire_Configuration_init, ctx: *mut c_void, @@ -122,4 +123,21 @@ extern "C-unwind" { // Initializes the require library and registers it globally. pub fn luaopen_require(L: *mut lua_State, config_init: luarequire_Configuration_init, ctx: *mut c_void); + + // Initializes and pushes a "proxyrequire" closure onto the stack. + // + // The closure takes two parameters: the string path to resolve and the chunkname of an existing + // module. + pub fn luarequire_pushproxyrequire( + L: *mut lua_State, + config_init: luarequire_Configuration_init, + ctx: *mut c_void, + ) -> c_int; + + // Registers an aliased require path to a result. + // + // After registration, the given result will always be immediately returned when the given path is + // required. + // Expects the path and table to be passed as arguments on the stack. + pub fn luarequire_registermodule(L: *mut lua_State) -> c_int; }