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

Any plan to support Rust integration? #772

Closed
linux-china opened this issue Apr 6, 2024 · 1 comment
Closed

Any plan to support Rust integration? #772

linux-china opened this issue Apr 6, 2024 · 1 comment

Comments

@linux-china
Copy link

I have submitted mlua-rs/mlua#354 to integrate Pluto with Rust, and nobody answers.
Any plan to supply Rust binding for Pluto. Now lots of CLI tools written by Rust, and I want to integrate Pluto in my project to enhance Lua features.

@Sainan
Copy link
Member

Sainan commented Apr 6, 2024

Providing language-specific bindings is a bit out of scope for us. Probably the closest to that we have done is PlutoScript, but that's also just using the C API via an FFI layer. Even when we integrate Pluto in C++, we use the C API directly without any abstractions/bindings. The same should be possible in Rust:

#[link(...)]
extern {
    fn luaL_newstate() -> *mut lua_State;
    // ...
}

fn main() {
    unsafe {
        let L = luaL_newstate();
        println!("Allocated lua state @ {:p}", L);
        // ...
    }
}

I understand the 'unsafe' part is probably undesirable, but I'm not sure how much safety can be assured when working with the Lua C API since there's many ways to mess up and crash with it, esp. in regards to Lua stack corruption.

@Sainan Sainan closed this as not planned Won't fix, can't repro, duplicate, stale Apr 6, 2024
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

2 participants