Macro rglua::iface

source · []
macro_rules! iface {
    ($name : literal, $iface : literal) => { ... };
}
Expand description

Quickly calls [get_interface_handle] and [get_from_interface] for you in one macro call. Errors are combined into one.

Examples

use rglua::prelude::*;
use rglua::interface::EngineClient;
#[gmod_open]
fn entry(l: LuaState) -> i32 {
    let factory: *mut EngineClient = iface!("engine", "VEngineClient015").expect("Couldn't get VEngineClient");
    let instance = unsafe { factory.as_ref().unwrap() };
    println!("Am I in game? {}", instance.IsInGame());
    0
}