rglua/interface/lua/
interface.rs

1use super::base::LuaBase;
2use super::prelude::*;
3use super::LuaObject;
4
5/// <https://github.com/danielga/garrysmod_common/blob/9981d4aaee15452a9b0f53436c1aa807f81f3fd6/include/GarrysMod/Lua/LuaInterface.h#L25>
6/// Basically what is given to ordinary C++ binary modules that do not interface with lua_shared.
7/// You can use this but should really just use the lua_shared bindings.
8#[vtable]
9pub struct LuaInterface {
10	pub base: *mut *mut LuaBase,
11
12	#[offset(1)]
13	pub Shutdown: extern "C" fn(),
14	pub Cycle: extern "C" fn(),
15
16	#[offset(3)]
17	pub Global: extern "C" fn() -> *mut LuaObject,
18	pub GetObject: extern "C" fn(index: c_int) -> *mut LuaObject,
19	pub PushLuaObject: extern "C" fn(o: *mut LuaObject),
20	pub PushLuaFunction: extern "C" fn(f: crate::types::LuaCFunction),
21	pub LuaError: extern "C" fn(err: *const c_char, idx: c_int),
22	pub TypeError: extern "C" fn(name: *const c_char, idx: c_int),
23	pub CallInternal: extern "C" fn(args: c_int, rets: c_int),
24
25	#[offset(20)]
26	pub IsServer: extern "C" fn() -> bool,
27
28	#[offset(21)]
29	pub IsClient: extern "C" fn() -> bool,
30
31	#[offset(22)]
32	pub IsMenu: extern "C" fn() -> bool,
33
34	#[offset(37)]
35	pub RunString: extern "C" fn(
36		filename: *const c_char,
37		path: *const c_char,
38		code: *const c_char,
39		run: bool,
40		show_errors: bool
41	) -> bool,
42
43	#[offset(39)]
44	pub Error: extern "C" fn(err: *const c_char),
45
46	#[offset(45)]
47	pub ErrorNoHalt: extern "C" fn(fmt: *const c_char, ...),
48	pub Msg: extern "C" fn(fmt: *const c_char, ...)
49}