2 releases
0.1.1 | Apr 28, 2024 |
---|---|
0.1.0 | Apr 28, 2024 |
#34 in #typing
105KB
2.5K
SLoC
Lua Engine
This is a simple implementation of a lua parser and execution engine
How to use it
use clap::Parser;
use lua_engine::evaluation::interpreter::Interpreter;
use lua_engine::evaluation::runtime::Runtime;
use lua_engine::evaluation::typing::{NumberType, Value};
#[derive(Parser, Debug)]
#[command(version, about, long_about = None)]
struct Args {
#[arg(short, long)]
path: String,
}
fn main() {
let args = Args::parse();
let mut interpreter = Interpreter::new();
let mut runtime = Runtime::new();
interpreter.prepare_runtime(&mut runtime);
runtime.add_global_variable("my_global", Value::Number(NumberType::Int(100)));
if let Some(result) = interpreter.evaluate_file(args.path, &mut runtime) {
println!("Received result: {:?}", result);
}
}
Dependencies
~225–670KB
~16K SLoC