diff options
Diffstat (limited to 'src/ffi/lua.rs')
-rw-r--r-- | src/ffi/lua.rs | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/src/ffi/lua.rs b/src/ffi/lua.rs index 53af3a2..d918443 100644 --- a/src/ffi/lua.rs +++ b/src/ffi/lua.rs @@ -14,6 +14,9 @@ pub use super::lua52::lua::*; #[cfg(any(feature = "lua51", feature = "luajit"))] pub use super::lua51::lua::*; +#[cfg(feature = "luau")] +pub use super::luau::lua::*; + #[cfg(feature = "lua52")] pub use super::compat53::{ lua_dump, lua_getextraspace, lua_getfield, lua_getglobal, lua_geti, lua_gettable, @@ -31,6 +34,14 @@ pub use super::compat53::{ lua_stringtonumber, lua_tointeger, lua_tointegerx, lua_tonumberx, }; +#[cfg(feature = "luau")] +pub use super::compat53::{ + lua_arith, lua_compare, lua_copy, lua_getextraspace, lua_getfield, lua_getglobal, lua_geti, + lua_gettable, lua_getuservalue, lua_isinteger, lua_len, lua_pushglobaltable, lua_pushlstring, + lua_pushstring, lua_rawget, lua_rawgeti, lua_rawgetp, lua_rawlen, lua_rawseti, lua_rawsetp, + lua_rotate, lua_seti, lua_setuservalue, lua_stringtonumber, lua_tointeger, lua_tointegerx, +}; + #[cfg(any(feature = "lua52", feature = "lua53", feature = "lua54",))] pub const LUA_MAX_UPVALUES: c_int = 255; @@ -40,6 +51,9 @@ pub const LUA_MAX_UPVALUES: c_int = 60; #[cfg(all(feature = "luajit", feature = "vendored"))] pub const LUA_MAX_UPVALUES: c_int = 120; +#[cfg(feature = "luau")] +pub const LUA_MAX_UPVALUES: c_int = 200; + // // Lua 5.4 compatibility layer // @@ -48,7 +62,8 @@ pub const LUA_MAX_UPVALUES: c_int = 120; feature = "lua53", feature = "lua52", feature = "lua51", - feature = "luajit" + feature = "luajit", + feature = "luau" ))] #[inline(always)] pub unsafe fn lua_resume( @@ -62,22 +77,32 @@ pub unsafe fn lua_resume( #[cfg(any(feature = "lua51", feature = "luajit"))] let ret = lua_resume_(L, narg); - #[cfg(any(feature = "lua53", feature = "lua52"))] + #[cfg(any(feature = "lua53", feature = "lua52", feature = "luau"))] let ret = lua_resume_(L, from, narg); - if ret == LUA_OK || ret == LUA_YIELD { + if (ret == LUA_OK || ret == LUA_YIELD) && !(nres.is_null()) { *nres = lua_gettop(L); } ret } -#[cfg(any(feature = "lua54", all(feature = "luajit", feature = "vendored")))] +#[cfg(any( + feature = "lua54", + feature = "luau", + all(feature = "luajit", feature = "vendored") +))] pub unsafe fn lua_resetthreadx(L: *mut lua_State, th: *mut lua_State) -> c_int { #[cfg(all(feature = "luajit", feature = "vendored"))] { lua_resetthread(L, th); LUA_OK } + #[cfg(feature = "luau")] + { + let _ = L; + lua_resetthread(th); + LUA_OK + } #[cfg(feature = "lua54")] { let _ = L; |