I noticed that you snagged a couple names on crates.io as well, so I came to take a look at what you were working on.
I'm opening this issue to help track the addition of an API that can be used from Safe Rust. My crate has an example of what using Luau from Safe Rust might look like; it compiles and runs but that's about all the functionality that's implemented right now:
use std::ffi::CStr;
use luau::vm::{Luau, StackValue, Value};
fn main() {
let vm = Luau::new().expect("failed to create Luau VM");
let compiled = Luau::compile("return ...")
.expect("failed to compile function");
let chunkname = CStr::from_bytes_with_nul(b"=basic_run.luau\0").expect("die");
let main_thread = vm.main_thread();
let function = main_thread.load_compiled(compiled, chunkname)
.expect("failed to load function");
println!("{:?}", function.call_sync([
Value::new_string(&main_thread, "hello world").unwrap(),
Value::new_string(&main_thread, "I like trains").unwrap(),
Value::new_string(&main_thread, "how about a table?").unwrap(),
Value::new_table(&main_thread, 0, 0).unwrap(),
Value::new_string(&main_thread, "I like trains").unwrap()
]));
// assert stack usage is balanced
assert_eq!(unsafe { StackValue::stack(main_thread.as_ptr()) }, Vec::new());
}
If you can manage to get autocxx to generate bindings to the high-level C++ magic like analysis and AST, your crate could pretty quickly speed ahead of mine in the compilation/analysis department, since I'm focusing on VM right now. Different versions of Luau can't be mixed in the same application (or else linking errors result), so I've just added a feature to my crate that allows users to disable compilation and linking to Luau so that people have the choice to use your crate as the compiler if they so choose.
Good luck and may the best crate win! :)
enhancement A-priority.medium