Skip to content

Commit

Permalink
Make Lua::push_value() and Lua::pop_value() public (but hidden fr…
Browse files Browse the repository at this point in the history
…om the docs).

Can be useful for low-level intergration with mlua values.
Also closes #215.
  • Loading branch information
khvzak committed Jul 11, 2023
1 parent bfd1c29 commit 9f0fc27
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/lua.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2295,8 +2295,11 @@ impl Lua {
extra.app_data.remove()
}

// Uses 2 stack spaces, does not call checkstack
pub(crate) unsafe fn push_value(&self, value: Value) -> Result<()> {
/// Pushes a value onto the Lua stack.
///
/// Uses 2 stack spaces, does not call checkstack.
#[doc(hidden)]
pub unsafe fn push_value(&self, value: Value) -> Result<()> {
let state = self.state();
match value {
Value::Nil => {
Expand Down Expand Up @@ -2356,8 +2359,11 @@ impl Lua {
Ok(())
}

// Uses 2 stack spaces, does not call checkstack
pub(crate) unsafe fn pop_value(&self) -> Value {
/// Pops a value from the Lua stack.
///
/// Uses 2 stack spaces, does not call checkstack.
#[doc(hidden)]
pub unsafe fn pop_value(&self) -> Value {
let state = self.state();
match ffi::lua_type(state, -1) {
ffi::LUA_TNIL => {
Expand Down

0 comments on commit 9f0fc27

Please sign in to comment.