mirror of
https://github.com/mlua-rs/mlua
synced 2026-06-08 16:05:43 +00:00
Add fastpath push_into_stack/from_stack methods for bool type
This commit is contained in:
@@ -434,6 +434,12 @@ impl<'lua> IntoLua<'lua> for bool {
|
||||
fn into_lua(self, _: &'lua Lua) -> Result<Value<'lua>> {
|
||||
Ok(Value::Boolean(self))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
unsafe fn push_into_stack(self, lua: &'lua Lua) -> Result<()> {
|
||||
ffi::lua_pushboolean(lua.state(), self as c_int);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl<'lua> FromLua<'lua> for bool {
|
||||
@@ -445,6 +451,10 @@ impl<'lua> FromLua<'lua> for bool {
|
||||
_ => Ok(true),
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn from_stack(idx: c_int, lua: &'lua Lua) -> Result<Self> {
|
||||
Ok(ffi::lua_toboolean(lua.state(), idx) != 0)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'lua> IntoLua<'lua> for LightUserData {
|
||||
|
||||
Reference in New Issue
Block a user