Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions crates/bevy_mod_scripting_functions/src/bevy/bevy_core.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
// @generated by cargo bevy-api-gen generate, modify the templates not this file
#![allow(clippy::all)]
#![allow(unused, deprecated, dead_code)]
#![cfg_attr(rustfmt, rustfmt_skip)]
use super::bevy_ecs::*;
use super::bevy_reflect::*;
use bevy_mod_scripting_core::{
AddContextInitializer, StoreDocumentation, bindings::ReflectReference,
};
use crate::{
bindings::proxy::{
LuaReflectRefProxy, LuaReflectRefMutProxy, LuaReflectValProxy, LuaValProxy,
LuaIdentityProxy,
},
type_data::RegisterLua, tealr::mlu::mlua::IntoLua,
};
#[derive(bevy_mod_scripting_derive::LuaProxy)]
#[proxy(
remote = "bevy::core::prelude::Name",
bms_core_path = "bevy_mod_scripting_core",
bms_lua_path = "crate",
functions[r#"

#[lua(
as_trait = "std::cmp::PartialEq::<bevy::core::prelude::Name>",
composite = "eq",
metamethod = "Eq",
)]
fn eq(
_self: Ref<bevy::core::prelude::Name>,
other: Ref<bevy::core::prelude::Name>,
) -> bool;

"#,
r#"

#[lua(as_trait = "std::clone::Clone")]
fn clone(_self: Ref<bevy::core::prelude::Name>) -> Val<bevy::core::prelude::Name>;

"#,
r#"
#[lua(metamethod="ToString")]
fn index(&self) -> String {
format!("{}", _self)
}
"#]
)]
pub struct Name {}
#[derive(Default)]
pub(crate) struct Globals;
impl crate::tealr::mlu::ExportInstances for Globals {
fn add_instances<'lua, T: crate::tealr::mlu::InstanceCollector<'lua>>(
self,
instances: &mut T,
) -> crate::tealr::mlu::mlua::Result<()> {
Ok(())
}
}
fn bevy_core_context_initializer(
_: &bevy_mod_scripting_core::script::ScriptId,
ctx: &mut crate::prelude::Lua,
) -> Result<(), bevy_mod_scripting_core::error::ScriptError> {
crate::tealr::mlu::set_global_env(Globals, ctx)?;
Ok(())
}
pub struct BevyCoreScriptingPlugin;
impl bevy::app::Plugin for BevyCoreScriptingPlugin {
fn build(&self, app: &mut bevy::prelude::App) {
app.register_lua_proxy::<bevy::core::prelude::Name>();
app.add_context_initializer::<()>(bevy_core_context_initializer);
app.add_documentation_fragment(
crate::docs::LuaDocumentationFragment::new(
"BevyCoreAPI",
|tw| {
tw.document_global_instance::<Globals>()
.expect("Something went wrong documenting globals")
.process_type::<LuaName>()
},
),
);
}
}
Loading