Crates.io | tinylj |
lib.rs | tinylj |
version | 0.1.3 |
source | src |
created_at | 2023-06-21 19:31:59.827392 |
updated_at | 2023-06-21 20:07:40.218988 |
description | Rust crate for calling LuaJIT from Rust |
homepage | |
repository | https://github.com/zatrit/tinylj/ |
max_upload_size | |
id | 896465 |
size | 54,910 |
Fork of luajit-rs
Crate for interfacing with LuaJIT from Rust, for running high-performance Lua code that can integrate with native-code written in rust.
use tinylj::{c_int, State, lua_fn};
fn return_42(state: &mut State) -> c_int {
state.push(42);
1
}
pub fn main() {
let mut state = State::new();
state.open_libs();
state.do_string(r#"print("Hello world!")"#);
state.push(lua_fn!(return_42));
state.set_global("return_42");
state.do_string(r#"print(return_42())"#);
}