|
| 1 | +// @generated by cargo bevy-api-gen generate, modify the templates not this file |
| 2 | +#![allow(clippy::all)] |
| 3 | +#![allow(unused, deprecated, dead_code)] |
| 4 | +#![cfg_attr(rustfmt, rustfmt_skip)] |
| 5 | +use super::bevy_ecs::*; |
| 6 | +use super::bevy_reflect::*; |
| 7 | +use bevy_mod_scripting_core::{ |
| 8 | + AddContextInitializer, StoreDocumentation, bindings::ReflectReference, |
| 9 | +}; |
| 10 | +use crate::{ |
| 11 | + bindings::proxy::{ |
| 12 | + LuaReflectRefProxy, LuaReflectRefMutProxy, LuaReflectValProxy, LuaValProxy, |
| 13 | + LuaIdentityProxy, |
| 14 | + }, |
| 15 | + type_data::RegisterLua, tealr::mlu::mlua::IntoLua, |
| 16 | +}; |
| 17 | +#[derive(bevy_mod_scripting_derive::LuaProxy)] |
| 18 | +#[proxy( |
| 19 | + remote = "bevy::core::prelude::Name", |
| 20 | + bms_core_path = "bevy_mod_scripting_core", |
| 21 | + bms_lua_path = "crate", |
| 22 | + functions[r#" |
| 23 | +
|
| 24 | + #[lua( |
| 25 | + as_trait = "std::cmp::PartialEq::<bevy::core::prelude::Name>", |
| 26 | + composite = "eq", |
| 27 | + metamethod = "Eq", |
| 28 | + )] |
| 29 | + fn eq( |
| 30 | + _self: Ref<bevy::core::prelude::Name>, |
| 31 | + other: Ref<bevy::core::prelude::Name>, |
| 32 | + ) -> bool; |
| 33 | +
|
| 34 | +"#, |
| 35 | + r#" |
| 36 | +
|
| 37 | + #[lua(as_trait = "std::clone::Clone")] |
| 38 | + fn clone(_self: Ref<bevy::core::prelude::Name>) -> Val<bevy::core::prelude::Name>; |
| 39 | +
|
| 40 | +"#, |
| 41 | + r#" |
| 42 | +#[lua(metamethod="ToString")] |
| 43 | +fn index(&self) -> String { |
| 44 | + format!("{}", _self) |
| 45 | +} |
| 46 | +"#] |
| 47 | +)] |
| 48 | +pub struct Name {} |
| 49 | +#[derive(Default)] |
| 50 | +pub(crate) struct Globals; |
| 51 | +impl crate::tealr::mlu::ExportInstances for Globals { |
| 52 | + fn add_instances<'lua, T: crate::tealr::mlu::InstanceCollector<'lua>>( |
| 53 | + self, |
| 54 | + instances: &mut T, |
| 55 | + ) -> crate::tealr::mlu::mlua::Result<()> { |
| 56 | + Ok(()) |
| 57 | + } |
| 58 | +} |
| 59 | +fn bevy_core_context_initializer( |
| 60 | + _: &bevy_mod_scripting_core::script::ScriptId, |
| 61 | + ctx: &mut crate::prelude::Lua, |
| 62 | +) -> Result<(), bevy_mod_scripting_core::error::ScriptError> { |
| 63 | + crate::tealr::mlu::set_global_env(Globals, ctx)?; |
| 64 | + Ok(()) |
| 65 | +} |
| 66 | +pub struct BevyCoreScriptingPlugin; |
| 67 | +impl bevy::app::Plugin for BevyCoreScriptingPlugin { |
| 68 | + fn build(&self, app: &mut bevy::prelude::App) { |
| 69 | + app.register_lua_proxy::<bevy::core::prelude::Name>(); |
| 70 | + app.add_context_initializer::<()>(bevy_core_context_initializer); |
| 71 | + app.add_documentation_fragment( |
| 72 | + crate::docs::LuaDocumentationFragment::new( |
| 73 | + "BevyCoreAPI", |
| 74 | + |tw| { |
| 75 | + tw.document_global_instance::<Globals>() |
| 76 | + .expect("Something went wrong documenting globals") |
| 77 | + .process_type::<LuaName>() |
| 78 | + }, |
| 79 | + ), |
| 80 | + ); |
| 81 | + } |
| 82 | +} |
0 commit comments