Skip to content

Commit 1754226

Browse files
committed
Impl IntoLua::push_into_stack for integers
1 parent 3014c4d commit 1754226

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/conversion.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,15 @@ macro_rules! lua_convert_int {
697697
message: Some("out of range".to_owned()),
698698
})
699699
}
700+
701+
#[inline]
702+
unsafe fn push_into_stack(self, lua: &'lua Lua) -> Result<()> {
703+
match cast(self) {
704+
Some(i) => ffi::lua_pushinteger(lua.state(), i),
705+
None => ffi::lua_pushnumber(lua.state(), self as ffi::lua_Number),
706+
}
707+
Ok(())
708+
}
700709
}
701710

702711
impl<'lua> FromLua<'lua> for $x {

0 commit comments

Comments
 (0)