Skip to content

ot2t7/departure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Departure

Departure is a bytecode library for Lua 5.1, written in rust. It allows you to input Lua 5.1 source code, and compile it into 5.1 bytecode, or deserialize that bytecode into a Rust struct that's easy to analyze.

Examples

use departure::deserialize;
use departure::Constant;
use departure::OpCode;

fn main() {
    let source = String::from(r#"
        print("Hello World!")
    "#);
    let deserialized = deserialize(&source).unwrap();

    assert_eq!(deserialized.instructions.len(), 4);
    assert_eq!(&deserialized.instructions[0].op_code, &OpCode::GetGlobal);
    match &deserialized.constants[0] {
        Constant::String(s) => {
            assert_eq!(s, "print");
        }
        _ => {}
    }
}

About

a lua 5.1 bytecode library

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages