hltas

crates.io Documentation

A crate for reading and writing Half-Life TAS scripts (.hltas).

Examples

```rust use hltas::{HLTAS, types::{JumpBug, Line, Times}};

let contents = "\ version 1 demo test frames ------b---|------|------|0.001|-|-|5";

match HLTAS::fromstr(&contents) { Ok(hltas) => { asserteq!(hltas.properties.demo, Some("test"));

    if let Line::FrameBulk(frame_bulk) = hltas.lines[0] {
        assert_eq!(
            frame_bulk.auto_actions.jump_bug,
            Some(JumpBug { times: Times::UnlimitedWithinFrameBulk })
        );
        assert_eq!(frame_bulk.frame_time, "0.001");
        assert_eq!(frame_bulk.frame_count.get(), 5);
    } else {
        unreachable!()
    }
}

// The errors are pretty-printed with context.
Err(error) => println!("{}", error),

} ```

C++ Wrapper

Also included is a C++ wrapper, exporting the same C++ interface as the previous C++ version of HLTAS.

Using the C++ wrapper from CMake

License: MIT/Apache-2.0