pub struct LuaRemote;Expand description
Registry of interfaces between scripts. An interface is simply a dictionary mapping names to functions. A script or mod can then register an interface with LuaRemote, after that any script can call the registered functions, provided it knows the interface name and the desired function name. An instance of LuaRemote is available through the global object named remote.
Implementations§
Source§impl LuaRemote
impl LuaRemote
Sourcepub fn interfaces(&self) -> HashMap<String, HashMap<String, bool>>
pub fn interfaces(&self) -> HashMap<String, HashMap<String, bool>>
List of all registered interfaces. For each interface name, remote.interfaces[name] is a dictionary mapping the interface’s registered functions to true.
Sourcepub fn object_name(&self) -> &'static str
pub fn object_name(&self) -> &'static str
The class name of this object. Available even when valid is false. For LuaStruct objects it may also be suffixed with a dotted path to a member of the struct.
Sourcepub fn add_interface(
&self,
functions: HashMap<String, LuaAny>,
name: &'static str,
)
pub fn add_interface( &self, functions: HashMap<String, LuaAny>, name: &'static str, )
Add a remote interface.
Sourcepub fn call(
&self,
function: &'static str,
interface: &'static str,
) -> Option<LuaAny>
pub fn call( &self, function: &'static str, interface: &'static str, ) -> Option<LuaAny>
Call a function of an interface.
Providing an unknown interface or function name will result in a script error.
Sourcepub fn remove_interface(&self, name: &'static str) -> bool
pub fn remove_interface(&self, name: &'static str) -> bool
Removes an interface with the given name.