@@ -16,7 +16,7 @@ use crate::stdlib::StdLib;
1616use crate :: string:: LuaString ;
1717use crate :: table:: Table ;
1818use crate :: thread:: Thread ;
19- use crate :: traits:: IntoLua ;
19+ use crate :: traits:: { FromLua , IntoLua } ;
2020use crate :: types:: {
2121 AppDataRef , AppDataRefMut , Callback , CallbackUpvalue , DestructedUserdata , Integer , LightUserData ,
2222 LuaType , MaybeSend , ReentrantMutex , RegistryKey , ValueRef , XRc ,
5050 std:: task:: { Context , Poll , Waker } ,
5151} ;
5252
53- /// An inner Lua struct which holds a raw Lua state.
53+ /// An internal Lua struct which holds a raw Lua state.
5454#[ doc( hidden) ]
5555pub struct RawLua {
5656 // The state is dynamic and depends on context
@@ -736,9 +736,19 @@ impl RawLua {
736736 value. push_into_stack ( self )
737737 }
738738
739+ /// Pops a value that implements [`FromLua`] from the top of the Lua stack.
740+ ///
741+ /// Uses up to 1 stack space, does not call `checkstack`.
742+ #[ inline( always) ]
743+ pub unsafe fn pop < R : FromLua > ( & self ) -> Result < R > {
744+ let v = R :: from_stack ( -1 , self ) ?;
745+ ffi:: lua_pop ( self . state ( ) , 1 ) ;
746+ Ok ( v)
747+ }
748+
739749 /// Pushes a `Value` (by reference) onto the Lua stack.
740750 ///
741- /// Uses 2 stack spaces, does not call `checkstack`.
751+ /// Uses up to 2 stack spaces, does not call `checkstack`.
742752 pub unsafe fn push_value ( & self , value : & Value ) -> Result < ( ) > {
743753 let state = self . state ( ) ;
744754 match value {
0 commit comments