Skip to content
/ gmrs Public

Rust library to create garry's mod binary modules

Notifications You must be signed in to change notification settings

diogo464/gmrs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gmrs

Rust library to create garry's mod binary modules.

Usage

Add this to your Cargo.toml.

[lib]
crate-type = ["cdylib"]

[dependencies]
gmrs = { git = "https://github.com/diogo464/gmrs" }

Compile using the i686-unknown-linux-gnu target, 64-bit might work as well but I couldn't get event get a c++ module working without crashing so rust probably wont work either.
Never tested on windows/osx.
If you get the error Couldn't load module library! while loading the module in garry's mod try compiling with an older version of GLIBC, using a container running ubuntu 18.04 will probably work.

Quick start

use gmrs::prelude::*;

#[gmrs::function]
fn hello_world(state: LuaState) -> lua::Result<()> {
    gmrs::print!(state, "Hello from rust");
    Ok(())
}

#[gmrs::entry]
fn main(state: LuaState) {
    gmrs::set_global(state, "rust_hello_world", NativeFunc::new(hello_world));
}

#[gmrs::exit]
fn exit(_state: LuaState) {}

About

Rust library to create garry's mod binary modules

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published