Skip to content
This repository was archived by the owner on Nov 12, 2025. It is now read-only.

Commit 42e30d4

Browse files
authored
Update README.md
1 parent 5536163 commit 42e30d4

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
# rglua
22

33
This is a Rust library that contains bindings for garrysmod binary module creation as well as more user-friendly interfaces to interact with lua states.
4+
45
More information on binary modules: https://wiki.facepunch.com/gmod/Creating_Binary_Modules
56

7+
An example module made with rglua is below
8+
69
## How to build
710

811
Add this to your Cargo.toml
@@ -17,14 +20,16 @@ rglua = { git = "https://github.com/Vurv78/rglua", branch = "main" } # This give
1720
Make sure you build to 32 bit if you want to use the module with srcds / on a local server.
1821
``cargo build --release --target=i686-pc-windows-msvc``
1922

20-
Also do
23+
Also do this if you have never compiled to 32 bit, to get rustup to install 32 bit versions of everything you need
2124
``rustup add target i686-pc-windows-msvc``
2225

2326
More Info and example module (Not made with rglua): https://github.com/Vurv78/gmod-rust-test
2427

28+
Note:
29+
I have never gotten anyone to test this on linux or OSX, It should work just fine however. Travis Ci Should give you an idea on how this runs on linux at least.
30+
2531
## Example Module
2632
```rust
27-
// This code may not work for you because of printgm. In that case, don't import it and take away the instances of it until #1 is fixed.
2833
use rglua::{RLuaState,LuaState,printgm};
2934
#[no_mangle]
3035
unsafe extern fn gmod13_open(state: LuaState) -> i32 {
@@ -33,13 +38,12 @@ unsafe extern fn gmod13_open(state: LuaState) -> i32 {
3338
wrapped.get_global(&"print");
3439
wrapped.push_string(&"Hello from rust!");
3540
wrapped.call(1,0);
36-
printgm!(wrapped,"Also hello!");
41+
printgm!(wrapped,"Another way to say hello!");
3742
0
3843
}
3944
#[no_mangle]
4045
unsafe extern fn gmod13_close(state: LuaState) -> i32 {
4146
let mut _wrapped = RLuaState::new(state);
42-
printgm!(_wrapped,"Goodbye!");
4347
0
4448
}
4549
```

0 commit comments

Comments
 (0)