rglua icon indicating copy to clipboard operation
rglua copied to clipboard

Future API

Open vurvdev opened this issue 4 years ago • 0 comments

Maybe Engine, Lua State, etc can be unified into one "Gmod" state object. I don't know the extent of proc-macros but I hope this can happen.

Example clientside binary module

use rglua::prelude::*;

// Either #[rglua::open] or #[rglua::open(interfaces..)]
// In this case, it tries to load the engine interface to add functions like is_connected
// Additionally maybe it can return a result?
#[rglua::open(engine)]
fn start_module(g: Gmod) -> i32 {
    printgm!(g, "{}", g.is_connected());
    0
}

#[rglua::close]
fn close_module(g: Gmod) -> i32 {
    0
}

vurvdev avatar Dec 19 '21 04:12 vurvdev