GitPedia

Rglua

Toolkit for garrysmod development with the source sdk and lua c api

From vurvdev·Updated April 6, 2026·View on GitHub·
·Archived

**rglua** is a Toolkit for garrysmod development with the source sdk and lua c api The project is written primarily in Rust, distributed under the MIT License license, first published in 2020. Key topics include: dll, garrys-mod, garrysmod, glua, gmod.

Latest release: v2.1.0rglua v2.1.0
January 24, 2022View Changelog →

⚠️ Deprecated

There is a new, nicer to use, slimmer rglua on the horizon.

For the lua api equivalent to rglua, autorun-lua
For access to source sdk bindings for gmod, autorun-interfaces

Don't let their names scare you. They're a part of the new Autorun-ng project, but similar to how rglua was to Autorun-rs, they will be able to be used outside of Autorun-ng.

Here's an example.

rs
/// A basic example of creating a binary module using `autorun-lua` /// Add this to your deps /// { git = "https://github.com/thevurv/Autorun-ng", package = "autorun-lua" } use autorun_lua::*; // Or return anyhow::Result<f64> fn lua_adder(lua: &LuaApi, state: *mut LuaState) -> Result<f64, Box<dyn std::error::Error>> { let x = lua.check_number(state, 1); let y = lua.check_number(state, 2); // This pushes it onto lua's stack for you. // You can return multiple values via a tuple of values // Additionally, Option<T> values work too, where None pushes nil. Ok(x + y) } #[unsafe(no_mangle)] pub extern "C-unwind" fn gmod13_open(state: *mut LuaState) -> std::ffi::c_int { let lua = autorun_lua::get_api().expect("Failed to get lua api"); lua.push_globals(state); // Push _G lua.push(state, "adder"); lua.push(state, as_lua_function!(lua_adder)); lua.set_table(state, -3); // _G["adder"] = lua_adder 0 }

🌑 rglua cratesio Build Status License github/Vurv78

This is a crate that allows interop with the (g)luajit c api as well as the source sdk through libloading and vtable bindings.
You can then use these for binary modules or manually injected code, like with Autorun-rs

More information on binary modules can be found on the garrysmod wiki: Creating Binary Modules and examples can be found here.

Usage

If you are targeting 32 bit make sure to install the toolchain and build to it:

bash
rustup target add i686-pc-windows-msvc cargo build --target=i686-pc-windows-msvc

Comparison

There are actually a decent amount of libraries out there for gmod development.
Here's a comparison and why you could use this one.

Libraryrgluarust-glua-sysgmod-rsgmrs
Full Lua C Api Bindings✔️
On Crates.io✔️✔️
Proc Macros✔️✔️✔️
Interfacing w/ Source SDK✔️
Returning Result<> from functions✔️✔️
Can be used on stable✔️✔️✔️
Real world examples✔️〰️✔️
Linux / OSX Support✔️✔️✔️
Github Stars😢👍👑🤷‍♂️

You can help with that last one 😉

Acknowledgements

garrysmod_common

This is heavily based off of garrysmod_common, in how we export the lua_shared functions and trying to replicate everything from the Lua C Api.

Contributors

Showing top 2 contributors by commit count.

View all contributors on GitHub →

This article is auto-generated from vurvdev/rglua via the GitHub API.Last fetched: 6/24/2026