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

Commit 8d85c6e

Browse files
authored
Mark rglua as deprecated and provide alternatives
Updated README to indicate deprecation of rglua and suggest alternatives.
1 parent 3c77ea1 commit 8d85c6e

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,45 @@
1+
# ⚠️ Deprecated
2+
3+
There is a new, nicer to use, slimmer rglua on the horizon.
4+
5+
For the lua api equivalent to rglua, [autorun-lua](https://github.com/thevurv/Autorun-ng/tree/master/packages/autorun-lua)
6+
For access to source sdk bindings for gmod, [autorun-interfaces](https://github.com/thevurv/Autorun-ng/tree/master/packages/autorun-interfaces)
7+
8+
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.
9+
10+
Here's an example.
11+
12+
```rs
13+
/// A basic example of creating a binary module using `autorun-lua`
14+
/// Add this to your deps
15+
/// { git = "https://github.com/thevurv/Autorun-ng", package = "autorun-lua" }
16+
use autorun_lua::*;
17+
18+
// Or return anyhow::Result<f64>
19+
fn lua_adder(lua: &LuaApi, state: *mut LuaState) -> Result<f64, Box<dyn std::error::Error>> {
20+
let x = lua.check_number(state, 1);
21+
let y = lua.check_number(state, 2);
22+
23+
// This pushes it onto lua's stack for you.
24+
// You can return multiple values via a tuple of values
25+
// Additionally, Option<T> values work too, where None pushes nil.
26+
Ok(x + y)
27+
}
28+
29+
#[unsafe(no_mangle)]
30+
pub extern "C-unwind" fn gmod13_open(state: *mut LuaState) -> std::ffi::c_int {
31+
let lua = autorun_lua::get_api().expect("Failed to get lua api");
32+
33+
lua.push_globals(state); // Push _G
34+
35+
lua.push(state, "adder");
36+
lua.push(state, as_lua_function!(lua_adder));
37+
lua.set_table(state, -3); // _G["adder"] = lua_adder
38+
39+
0
40+
}
41+
```
42+
143
# 🌑 ``rglua`` [![cratesio](https://img.shields.io/crates/v/rglua.svg)](https://crates.io/crates/rglua) ![Build Status](https://github.com/Vurv78/rglua/actions/workflows/ci.yml/badge.svg) [![License](https://img.shields.io/github/license/Vurv78/rglua?color=red)](https://opensource.org/licenses/Apache-2.0) [![github/Vurv78](https://img.shields.io/discord/824727565948157963?label=Discord&logo=discord&logoColor=ffffff&labelColor=7289DA&color=2c2f33)](https://discord.gg/epJFC6cNsw)
244

345
This is a crate that allows interop with the (g)luajit c api as well as the source sdk through libloading and vtable bindings.

0 commit comments

Comments
 (0)