jarkonik / jarkonik/bevy_scriptum

Single argument function calls dont work.

Open
#33 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
171
Forks
19
PR merge metrics
No merged PRs in 30d

Description

On Main branch calling with a single argument tuple or single argument in either direction doesn't work.

Calling Rust from Lua

```
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_scripting::(|runtime| {
runtime.add_function(String::from("func_with_params"), |In((a)): In<(i64)>| {
//doesnt compile trait bounds not satisfied.
});
})
.run();
}
```

Calling Lua from Rust
```
fn call_lua_on_update_from_rust(
mut scripted_entities: Query<(Entity, &mut LuaScriptData)>,
scripting_runtime: ResMut,
) {
for (entity, mut script_data) in &mut scripted_entities {
scripting_runtime
.call_fn("on_update", &mut script_data, entity, (123)) //FuncArgs not satisfied
.unwrap();
}
}

function on_update(a)
print(a) -- 123
end

```

Calling Lua from Rust will work if I replace the single argument tuple with a vec e.g. vec![123]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing both examples on the Main branch: Rust-to-Lua registration through add_function and Lua-to-Rust calls through call_fn. Read the FuncArgs implementations and related argument-conversion entry points. Done means a single scalar and a one-element tuple work in both directions, while existing vector calls continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua, rust
Domain
game-dev, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.