gma-lite

Crates.iogma-lite
lib.rsgma-lite
version0.3.1
created_at2025-08-25 23:44:17.336781+00
updated_at2025-08-29 21:59:49.526656+00
descriptionLite GMA (Garry's Mod Addon) archive reader/writer
homepage
repositoryhttps://github.com/Srlion/gma-lite
max_upload_size
id1810304
size12,200
(Srlion)

documentation

README

gma-lite

Minimal Rust library to read and write Garry's Mod Addon (.gma) archives.

Usage

Read a GMA

use gma_lite::read;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let bytes = std::fs::read("addon.gma")?;
    let entries = read(&bytes[..])?; // Vec<GMAFile>

    for e in &entries {
        println!("{} ({} bytes)", e.name(), e.size());
    }
    Ok(())
}

Build a GMA

use gma_lite::Builder;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut b = Builder::new("My Addon", 76561197960287930);
    b.set_author("you");
    b.set_description("Example addon");
    b.file_from_string("lua/autorun/example.lua", "print('hello from gma-lite')");

    let mut out = Vec::new();
    b.write_to(&mut out)?;
    std::fs::write("my_addon.gma", out)?;
    Ok(())
}

API

See src/lib.rs for format details and error types.

License

MIT

Commit count: 0

cargo fmt