#lua #garrys-mod #gmod #glua #api-bindings

rglua

Toolkit for garrysmod development with the source sdk and luajit api

14 releases (5 stable)

3.0.0 Dec 29, 2024
3.0.0-beta2 Apr 1, 2022
3.0.0-beta Feb 20, 2022
2.1.0 Jan 24, 2022
0.5.0 Nov 26, 2021

#588 in Game dev

Download history 34/week @ 2024-09-29 5/week @ 2024-10-27 21/week @ 2024-11-03 22/week @ 2024-12-01 36/week @ 2024-12-08 17/week @ 2024-12-15 120/week @ 2024-12-29 10/week @ 2025-01-05 3/week @ 2025-01-12

133 downloads per month

MIT license

125KB
2K SLoC

🌑 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:

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.

Library rglua rust-glua-sys gmod-rs gmrs
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.

Dependencies

~0.3–1MB
~18K SLoC