Skip to content

Commit e67ae7f

Browse files
committed
Make RawLua::{push,push_value,pop_value} public
1 parent 8c1535c commit e67ae7f

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/state/raw.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -732,14 +732,14 @@ impl RawLua {
732732
///
733733
/// Uses up to 2 stack spaces to push a single value, does not call `checkstack`.
734734
#[inline(always)]
735-
pub(crate) unsafe fn push(&self, value: impl IntoLua) -> Result<()> {
735+
pub unsafe fn push(&self, value: impl IntoLua) -> Result<()> {
736736
value.push_into_stack(self)
737737
}
738738

739739
/// Pushes a `Value` (by reference) onto the Lua stack.
740740
///
741741
/// Uses 2 stack spaces, does not call `checkstack`.
742-
pub(crate) unsafe fn push_value(&self, value: &Value) -> Result<()> {
742+
pub unsafe fn push_value(&self, value: &Value) -> Result<()> {
743743
let state = self.state();
744744
match value {
745745
Value::Nil => ffi::lua_pushnil(state),
@@ -773,7 +773,8 @@ impl RawLua {
773773
/// Pops a value from the Lua stack.
774774
///
775775
/// Uses up to 1 stack spaces, does not call `checkstack`.
776-
pub(crate) unsafe fn pop_value(&self) -> Value {
776+
#[inline]
777+
pub unsafe fn pop_value(&self) -> Value {
777778
let value = self.stack_value(-1, None);
778779
ffi::lua_pop(self.state(), 1);
779780
value

src/util/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ where
208208
F: FnOnce(*mut ffi::lua_State) -> R,
209209
R: Copy,
210210
{
211-
let params = ffi::lua_touserdata(state, -1) as *mut Params<F, R>;
211+
let params = ffi::lua_tolightuserdata(state, -1) as *mut Params<F, R>;
212212
ffi::lua_pop(state, 1);
213213

214214
let f = (*params).function.take().unwrap();
@@ -239,7 +239,7 @@ where
239239

240240
ffi::lua_pushlightuserdata(state, &mut params as *mut Params<F, R> as *mut c_void);
241241
let ret = ffi::lua_pcall(state, nargs + 1, nresults, stack_start + 1);
242-
ffi::lua_remove(state, stack_start + 1);
242+
ffi::lua_remove(state, stack_start + 1); // remove error handler
243243

244244
if ret == ffi::LUA_OK {
245245
// `LUA_OK` is only returned when the `do_call` function has completed successfully, so

0 commit comments

Comments
 (0)