@@ -1413,8 +1413,8 @@ impl Lua {
14131413 let protect = !self . unlikely_memory_error ( ) ;
14141414 push_table ( state, 0 , lower_bound, protect) ?;
14151415 for ( k, v) in iter {
1416- self . push_value ( k . into_lua ( self ) ? ) ?;
1417- self . push_value ( v . into_lua ( self ) ? ) ?;
1416+ self . push ( k ) ?;
1417+ self . push ( v ) ?;
14181418 if protect {
14191419 protect_lua ! ( state, 3 , 1 , fn ( state) ffi:: lua_rawset( state, -3 ) ) ?;
14201420 } else {
@@ -1442,7 +1442,7 @@ impl Lua {
14421442 let protect = !self . unlikely_memory_error ( ) ;
14431443 push_table ( state, lower_bound, 0 , protect) ?;
14441444 for ( i, v) in iter. enumerate ( ) {
1445- self . push_value ( v . into_lua ( self ) ? ) ?;
1445+ self . push ( v ) ?;
14461446 if protect {
14471447 protect_lua ! ( state, 2 , 1 , |state| {
14481448 ffi:: lua_rawseti( state, -2 , ( i + 1 ) as Integer ) ;
@@ -1977,12 +1977,11 @@ impl Lua {
19771977 T : IntoLua < ' lua > ,
19781978 {
19791979 let state = self . state ( ) ;
1980- let t = t. into_lua ( self ) ?;
19811980 unsafe {
19821981 let _sg = StackGuard :: new ( state) ;
19831982 check_stack ( state, 5 ) ?;
19841983
1985- self . push_value ( t) ?;
1984+ self . push ( t) ?;
19861985 rawset_field ( state, ffi:: LUA_REGISTRYINDEX , name)
19871986 }
19881987 }
@@ -2269,6 +2268,12 @@ impl Lua {
22692268 extra. app_data . remove ( )
22702269 }
22712270
2271+ #[ doc( hidden) ]
2272+ #[ inline( always) ]
2273+ pub unsafe fn push < ' lua > ( & ' lua self , value : impl IntoLua < ' lua > ) -> Result < ( ) > {
2274+ value. push_into_stack ( self )
2275+ }
2276+
22722277 /// Pushes a value onto the Lua stack.
22732278 ///
22742279 /// Uses 2 stack spaces, does not call checkstack.
@@ -2643,12 +2648,12 @@ impl Lua {
26432648 let metatable_nrec = metatable_nrec + registry. async_meta_methods . len ( ) ;
26442649 push_table ( state, 0 , metatable_nrec, true ) ?;
26452650 for ( k, m) in registry. meta_methods {
2646- self . push_value ( Value :: Function ( self . create_callback ( m) ?) ) ?;
2651+ self . push ( self . create_callback ( m) ?) ?;
26472652 rawset_field ( state, -2 , MetaMethod :: validate ( & k) ?) ?;
26482653 }
26492654 #[ cfg( feature = "async" ) ]
26502655 for ( k, m) in registry. async_meta_methods {
2651- self . push_value ( Value :: Function ( self . create_async_callback ( m) ?) ) ?;
2656+ self . push ( self . create_async_callback ( m) ?) ?;
26522657 rawset_field ( state, -2 , MetaMethod :: validate ( & k) ?) ?;
26532658 }
26542659 let mut has_name = false ;
@@ -2699,7 +2704,7 @@ impl Lua {
26992704 if field_getters_nrec > 0 {
27002705 push_table ( state, 0 , field_getters_nrec, true ) ?;
27012706 for ( k, m) in registry. field_getters {
2702- self . push_value ( Value :: Function ( self . create_callback ( m) ?) ) ?;
2707+ self . push ( self . create_callback ( m) ?) ?;
27032708 rawset_field ( state, -2 , & k) ?;
27042709 }
27052710 field_getters_index = Some ( ffi:: lua_absindex ( state, -1 ) ) ;
@@ -2711,7 +2716,7 @@ impl Lua {
27112716 if field_setters_nrec > 0 {
27122717 push_table ( state, 0 , field_setters_nrec, true ) ?;
27132718 for ( k, m) in registry. field_setters {
2714- self . push_value ( Value :: Function ( self . create_callback ( m) ?) ) ?;
2719+ self . push ( self . create_callback ( m) ?) ?;
27152720 rawset_field ( state, -2 , & k) ?;
27162721 }
27172722 field_setters_index = Some ( ffi:: lua_absindex ( state, -1 ) ) ;
@@ -2734,12 +2739,12 @@ impl Lua {
27342739 }
27352740 }
27362741 for ( k, m) in registry. methods {
2737- self . push_value ( Value :: Function ( self . create_callback ( m) ?) ) ?;
2742+ self . push ( self . create_callback ( m) ?) ?;
27382743 rawset_field ( state, -2 , & k) ?;
27392744 }
27402745 #[ cfg( feature = "async" ) ]
27412746 for ( k, m) in registry. async_methods {
2742- self . push_value ( Value :: Function ( self . create_async_callback ( m) ?) ) ?;
2747+ self . push ( self . create_async_callback ( m) ?) ?;
27432748 rawset_field ( state, -2 , & k) ?;
27442749 }
27452750 match index_type {
@@ -2990,7 +2995,7 @@ impl Lua {
29902995 nresults => {
29912996 let results = MultiValue :: from_stack_multi ( nresults, lua) ?;
29922997 ffi:: lua_pushinteger ( state, nresults as _ ) ;
2993- lua. push_value ( Value :: Table ( lua. create_sequence_from ( results) ?) ) ?;
2998+ lua. push ( lua. create_sequence_from ( results) ?) ?;
29942999 Ok ( 2 )
29953000 }
29963001 }
0 commit comments