Static rglua::lua::lua_getinfo [−][src]
pub static lua_getinfo: Lazy<extern "C" fn(l: LuaState, what: LuaString, ar: *mut LuaDebug) -> c_int>Expand description
Returns information about a specific function or function invocation.
To get information about a function you push it onto the stack and start the what string with the character ‘>’. (In that case, lua_getinfo pops the function in the top of the stack.)
Examples
To know in which line a function f was defined, you can write the following code:
use rglua::prelude::*;
#[gmod_open]
fn entry(l: LuaState) -> i32 {
let mut ar = LuaDebug::default();
lua_getglobal(l, cstr!("f")); // Get global 'f'
lua_getinfo(l, cstr!(">S"), &mut ar);
printgm!(l, "{}", ar.linedefined);
0
}