Crates.io | lua_ir |
lib.rs | lua_ir |
version | 0.7.1 |
source | src |
created_at | 2024-09-18 04:24:14.828597 |
updated_at | 2024-10-26 15:43:37.271508 |
description | lua runtime and IR generation |
homepage | |
repository | https://github.com/ehwan/lua_rust |
max_upload_size | |
id | 1378719 |
size | 244,610 |
lua syntax parser & runtime interpreter in Rust
32bit
: use 32bit integer and float for lua numeric
typeadd lua_ir
crate to your Cargo.toml
[dependencies]
lua_ir = "..."
let mut env = lua_ir::LuaEnv::new();
env.eval_chunk( b"var_hello = 'Hello'" )?;
env.eval_chunk( b"var_world = 'World'" )?;
env.eval_chunk( b"print( var_hello .. ', ' .. var_world .. '!' )" )?;
// Hello, World!
let hello_value = env.get_global( "var_hello" )?;
let world_value = env.get_global( "var_world" )?;
env.set_global( "var_hello", 10.into() )?;
clone this repository and simply run
$ cargo run <source_file.lua>
or
$ cargo run
will start lua REPL. Note that this executable is not cargo publish
ed.