@@ -85,38 +85,73 @@ use bevy_script_api::{
8585 r#"
8686#[lua(kind="MetaMethod", metamethod="ToString")]
8787fn index(&self) -> String {
88- format!("{}", _self)
88+ format!("{:? }", _self)
8989}
9090"# ]
9191) ]
9292struct Entity { }
9393#[ derive( bevy_mod_scripting_lua_derive:: LuaProxy ) ]
94- #[ proxy( derive( ) , remote = "bevy::ecs::world::OnAdd" , functions[ ] ) ]
94+ #[ proxy(
95+ derive( ) ,
96+ remote = "bevy::ecs::world::OnAdd" ,
97+ functions[ r#"
98+ #[lua(kind="MetaMethod", metamethod="ToString")]
99+ fn index(&self) -> String {
100+ format!("{:?}", _self)
101+ }
102+ "# ]
103+ ) ]
95104struct OnAdd { }
96105#[ derive( bevy_mod_scripting_lua_derive:: LuaProxy ) ]
97- #[ proxy( derive( ) , remote = "bevy::ecs::world::OnInsert" , functions[ ] ) ]
106+ #[ proxy(
107+ derive( ) ,
108+ remote = "bevy::ecs::world::OnInsert" ,
109+ functions[ r#"
110+ #[lua(kind="MetaMethod", metamethod="ToString")]
111+ fn index(&self) -> String {
112+ format!("{:?}", _self)
113+ }
114+ "# ]
115+ ) ]
98116struct OnInsert { }
99117#[ derive( bevy_mod_scripting_lua_derive:: LuaProxy ) ]
100- #[ proxy( derive( ) , remote = "bevy::ecs::world::OnRemove" , functions[ ] ) ]
118+ #[ proxy(
119+ derive( ) ,
120+ remote = "bevy::ecs::world::OnRemove" ,
121+ functions[ r#"
122+ #[lua(kind="MetaMethod", metamethod="ToString")]
123+ fn index(&self) -> String {
124+ format!("{:?}", _self)
125+ }
126+ "# ]
127+ ) ]
101128struct OnRemove { }
102129#[ derive( bevy_mod_scripting_lua_derive:: LuaProxy ) ]
130+ #[ proxy(
131+ derive( ) ,
132+ remote = "bevy::ecs::world::OnReplace" ,
133+ functions[ r#"
134+ #[lua(kind="MetaMethod", metamethod="ToString")]
135+ fn index(&self) -> String {
136+ format!("{:?}", _self)
137+ }
138+ "# ]
139+ ) ]
140+ struct OnReplace { }
141+ #[ derive( bevy_mod_scripting_lua_derive:: LuaProxy ) ]
103142#[ proxy(
104143 derive( clone) ,
105144 remote = "bevy::ecs::component::ComponentId" ,
106145 functions[ r#"
107- /// Creates a new [`ComponentId`].
108- /// The `index` is a unique value associated with each type of component in a given world.
109- /// Usually, this value is taken from a counter incremented for each type of component registered with the world.
110146
111- #[lua(kind = "Function ", output(proxy) )]
112- fn new(index: usize ) -> bevy::ecs::component::ComponentId ;
147+ #[lua(as_trait = "std::cmp::Eq ", kind = "Method" )]
148+ fn assert_receiver_is_total_eq(&self ) -> () ;
113149
114150"# ,
115151 r#"
116- /// Returns the index of the current component.
117152
118- #[lua(kind = "Method")]
119- fn index( self) -> usize ;
153+ #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy) )]
154+ fn clone(& self) -> bevy::ecs::component::ComponentId ;
120155
121156"# ,
122157 r#"
@@ -131,15 +166,19 @@ struct OnRemove {}
131166
132167"# ,
133168 r#"
169+ /// Creates a new [`ComponentId`].
170+ /// The `index` is a unique value associated with each type of component in a given world.
171+ /// Usually, this value is taken from a counter incremented for each type of component registered with the world.
134172
135- #[lua(as_trait = "std::clone::Clone", kind = "Method ", output(proxy))]
136- fn clone(&self ) -> bevy::ecs::component::ComponentId;
173+ #[lua(kind = "Function ", output(proxy))]
174+ fn new(index: usize ) -> bevy::ecs::component::ComponentId;
137175
138176"# ,
139177 r#"
178+ /// Returns the index of the current component.
140179
141- #[lua(as_trait = "std::cmp::Eq", kind = "Method")]
142- fn assert_receiver_is_total_eq(& self) -> () ;
180+ #[lua(kind = "Method")]
181+ fn index( self) -> usize ;
143182
144183"# ,
145184 r#"
@@ -156,13 +195,8 @@ struct ComponentId();
156195 remote = "bevy::ecs::component::Tick" ,
157196 functions[ r#"
158197
159- #[lua(
160- as_trait = "std::cmp::PartialEq",
161- kind = "MetaFunction",
162- composite = "eq",
163- metamethod = "Eq",
164- )]
165- fn eq(&self, #[proxy] other: &component::Tick) -> bool;
198+ #[lua(as_trait = "std::cmp::Eq", kind = "Method")]
199+ fn assert_receiver_is_total_eq(&self) -> ();
166200
167201"# ,
168202 r#"
@@ -208,8 +242,13 @@ struct ComponentId();
208242"# ,
209243 r#"
210244
211- #[lua(as_trait = "std::cmp::Eq", kind = "Method")]
212- fn assert_receiver_is_total_eq(&self) -> ();
245+ #[lua(
246+ as_trait = "std::cmp::PartialEq",
247+ kind = "MetaFunction",
248+ composite = "eq",
249+ metamethod = "Eq",
250+ )]
251+ fn eq(&self, #[proxy] other: &component::Tick) -> bool;
213252
214253"# ,
215254 r#"
@@ -311,12 +350,6 @@ struct ComponentTicks {}
311350 )]
312351 fn eq(&self, #[proxy] other: &identifier::Identifier) -> bool;
313352
314- "# ,
315- r#"
316-
317- #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))]
318- fn clone(&self) -> bevy::ecs::identifier::Identifier;
319-
320353"# ,
321354 r#"
322355/// Returns the value of the low segment of the [`Identifier`].
@@ -348,6 +381,12 @@ struct ComponentTicks {}
348381 #[lua(kind = "Function", output(proxy))]
349382 fn from_bits(value: u64) -> bevy::ecs::identifier::Identifier;
350383
384+ "# ,
385+ r#"
386+
387+ #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))]
388+ fn clone(&self) -> bevy::ecs::identifier::Identifier;
389+
351390"# ,
352391 r#"
353392#[lua(kind="MetaMethod", metamethod="ToString")]
@@ -369,6 +408,27 @@ struct Identifier {}
369408"# ]
370409) ]
371410struct EntityHash { }
411+ #[ derive( bevy_mod_scripting_lua_derive:: LuaProxy ) ]
412+ #[ proxy(
413+ derive( clone) ,
414+ remote = "bevy::ecs::removal_detection::RemovedComponentEntity" ,
415+ functions[ r#"
416+
417+ #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))]
418+ fn clone(&self) -> bevy::ecs::removal_detection::RemovedComponentEntity;
419+
420+ "# ,
421+ r#"
422+ #[lua(kind="MetaMethod", metamethod="ToString")]
423+ fn index(&self) -> String {
424+ format!("{:?}", _self)
425+ }
426+ "# ]
427+ ) ]
428+ struct RemovedComponentEntity ( ) ;
429+ #[ derive( bevy_mod_scripting_lua_derive:: LuaProxy ) ]
430+ #[ proxy( derive( ) , remote = "bevy::ecs::system::SystemIdMarker" , functions[ ] ) ]
431+ struct SystemIdMarker { }
372432#[ derive( Default ) ]
373433pub ( crate ) struct Globals ;
374434impl bevy_mod_scripting_lua:: tealr:: mlu:: ExportInstances for Globals {
@@ -428,6 +488,7 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyEcsAPIProvider {
428488 . process_type :: < LuaOnAdd > ( )
429489 . process_type :: < LuaOnInsert > ( )
430490 . process_type :: < LuaOnRemove > ( )
491+ . process_type :: < LuaOnReplace > ( )
431492 . process_type :: < LuaComponentId > ( )
432493 . process_type :: <
433494 bevy_mod_scripting_lua:: tealr:: mlu:: UserDataProxy <
@@ -446,6 +507,8 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyEcsAPIProvider {
446507 > ,
447508 > ( )
448509 . process_type :: < LuaEntityHash > ( )
510+ . process_type :: < LuaRemovedComponentEntity > ( )
511+ . process_type :: < LuaSystemIdMarker > ( )
449512 } ,
450513 ) ,
451514 )
@@ -470,10 +533,15 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyEcsAPIProvider {
470533 app. register_foreign_lua_type :: < bevy:: ecs:: world:: OnAdd > ( ) ;
471534 app. register_foreign_lua_type :: < bevy:: ecs:: world:: OnInsert > ( ) ;
472535 app. register_foreign_lua_type :: < bevy:: ecs:: world:: OnRemove > ( ) ;
536+ app. register_foreign_lua_type :: < bevy:: ecs:: world:: OnReplace > ( ) ;
473537 app. register_foreign_lua_type :: < bevy:: ecs:: component:: ComponentId > ( ) ;
474538 app. register_foreign_lua_type :: < bevy:: ecs:: component:: Tick > ( ) ;
475539 app. register_foreign_lua_type :: < bevy:: ecs:: component:: ComponentTicks > ( ) ;
476540 app. register_foreign_lua_type :: < bevy:: ecs:: identifier:: Identifier > ( ) ;
477541 app. register_foreign_lua_type :: < bevy:: ecs:: entity:: EntityHash > ( ) ;
542+ app. register_foreign_lua_type :: <
543+ bevy:: ecs:: removal_detection:: RemovedComponentEntity ,
544+ > ( ) ;
545+ app. register_foreign_lua_type :: < bevy:: ecs:: system:: SystemIdMarker > ( ) ;
478546 }
479547}
0 commit comments