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.
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
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 ๐
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.