mod loader; mod state; mod value; #[cfg (test)] mod tests; fn main () { use state::State; let lua_file = { let source = std::fs::read ("test_vectors/hello.lua").expect ("couldn't load Lua source code"); let bytecode = loader::compile_bytecode(source); let mut rdr = std::io::Cursor::new (bytecode); loader::parse_chunk (&mut rdr).unwrap () }; let mut vm = State::default (); if std::env::var("LUA_DEBUG").is_ok() { vm.debug_print = true; } let upvalues = State::upvalues_from_args (std::env::args ()); vm.breakpoints.push (state::Breakpoint { block_idx: 3, program_counter: 0, }); vm.execute_chunk (&lua_file, &upvalues); }