I'm working on a crate that adds scripting for Bevy that I plan to use in my game.
Bevy provides a structure called App, which can provide access to World via App::world/world_mut. The App is owned by Rust side and I can temporary pass a reference to it using the scope API. But inside Lua I sometimes need access to the World. Is it possible to somehow return a mutable reference to the world from a method that will be invalidated together with the App? I.e. I basically need to return a "subreference". I know that it will be valid as long as the App itself.
I'm working on a crate that adds scripting for Bevy that I plan to use in my game.
Bevy provides a structure called
App, which can provide access toWorldviaApp::world/world_mut. TheAppis owned by Rust side and I can temporary pass a reference to it using the scope API. But inside Lua I sometimes need access to theWorld. Is it possible to somehow return a mutable reference to the world from a method that will be invalidated together with theApp? I.e. I basically need to return a "subreference". I know that it will be valid as long as theAppitself.