jarkonik / jarkonik/bevy_scriptum
call_fn inside with_engine caused deadlock
- Dominant language
- Rust
- Stars
- 171
- Forks
- 19
- PR merge metrics
- No merged PRs in 30d
Description
```rust
fn call_lua_on_update_from_rust(
mut scripted_entities: Query<(Entity, &mut LuaScriptData)>,
scripting_runtime: ResMut,
mut exit: EventWriter,
) {
for (entity, mut script_data) in &mut scripted_entities {
scripting_runtime.with_engine(|engine| {
let val = scripting_runtime
.call_fn("get_value", &mut script_data, entity, ())
.unwrap()
.0;
println!(
"script returned: {}",
engine.registry_value::(&val).unwrap()
);
});
exit.write(AppExit::Success);
}
}
```
Caused deadlock
Contributor guide
Research direction
No file or test is named. Start by reproducing the shown call_fn inside with_engine example and tracing the locking interaction; done means the call no longer deadlocks while preserving the demonstrated script result and exit behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua, rust
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100