Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single argument function calls dont work. #33

Open
dgriffith0 opened this issue Aug 18, 2024 · 0 comments
Open

Single argument function calls dont work. #33

dgriffith0 opened this issue Aug 18, 2024 · 0 comments

Comments

@dgriffith0
Copy link

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::<LuaRuntime>(|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<LuaRuntime>,
) {
    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]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant