File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -961,9 +961,9 @@ impl RawLua {
961961 #[ cfg( feature = "luau" ) ]
962962 let extra_init = None ;
963963 #[ cfg( not( feature = "luau" ) ) ]
964- let extra_init: Option < fn ( * mut ffi:: lua_State ) -> Result < ( ) > > = Some ( |state| {
964+ let extra_init: Option < fn ( * mut ffi:: lua_State , c_int ) -> Result < ( ) > > = Some ( |state, mt_idx | {
965965 ffi:: lua_pushcfunction ( state, crate :: util:: userdata_destructor :: < UserDataStorage < T > > ) ;
966- rawset_field ( state, - 2 , "__gc" )
966+ rawset_field ( state, mt_idx , "__gc" )
967967 } ) ;
968968
969969 init_userdata_metatable (
Original file line number Diff line number Diff line change @@ -152,7 +152,7 @@ pub(crate) unsafe fn init_userdata_metatable(
152152 field_getters : Option < c_int > ,
153153 field_setters : Option < c_int > ,
154154 methods : Option < c_int > ,
155- extra_init : Option < fn ( * mut ffi:: lua_State ) -> Result < ( ) > > ,
155+ extra_init : Option < fn ( * mut ffi:: lua_State , c_int ) -> Result < ( ) > > ,
156156) -> Result < ( ) > {
157157 if field_getters. is_some ( ) || methods. is_some ( ) {
158158 // Push `__index` generator function
@@ -197,7 +197,7 @@ pub(crate) unsafe fn init_userdata_metatable(
197197
198198 // Additional initialization
199199 if let Some ( extra_init) = extra_init {
200- extra_init ( state) ?;
200+ extra_init ( state, metatable ) ?;
201201 }
202202
203203 ffi:: lua_pushboolean ( state, 0 ) ;
You can’t perform that action at this time.
0 commit comments