Trait mlua_extras::extras::LuaExtras
source · pub trait LuaExtras {
Show 17 methods
// Required methods
fn path(&self) -> Result<String>;
fn cpath(&self) -> Result<String>;
fn prepend_path<S: AsRef<Path>>(&self, path: S) -> Result<()>;
fn prepend_paths<S: AsRef<Path>>(
&self,
paths: impl IntoIterator<Item = S>,
) -> Result<()>;
fn append_path<S: AsRef<Path>>(&self, path: S) -> Result<()>;
fn append_paths<S: AsRef<Path>>(
&self,
paths: impl IntoIterator<Item = S>,
) -> Result<()>;
fn set_path<S: AsRef<Path>>(&self, path: S) -> Result<()>;
fn set_paths<S: AsRef<Path>>(
&self,
paths: impl IntoIterator<Item = S>,
) -> Result<()>;
fn prepend_cpath<S: AsRef<Path>>(&self, path: S) -> Result<()>;
fn prepend_cpaths<S: AsRef<Path>>(
&self,
paths: impl IntoIterator<Item = S>,
) -> Result<()>;
fn append_cpath<S: AsRef<Path>>(&self, path: S) -> Result<()>;
fn append_cpaths<S: AsRef<Path>>(
&self,
paths: impl IntoIterator<Item = S>,
) -> Result<()>;
fn set_cpath<S: AsRef<Path>>(&self, path: S) -> Result<()>;
fn set_cpaths<S: AsRef<Path>>(
&self,
paths: impl IntoIterator<Item = S>,
) -> Result<()>;
fn set_global<'lua, K, V>(&'lua self, key: K, value: V) -> Result<()>
where K: IntoLua<'lua>,
V: IntoLua<'lua>;
fn set_global_function<'lua, K, A, R, F>(
&'lua self,
key: K,
value: F,
) -> Result<()>
where K: IntoLua<'lua>,
A: FromLuaMulti<'lua>,
R: IntoLuaMulti<'lua>,
F: Fn(&'lua Lua, A) -> Result<R> + Send + 'static;
fn require<'lua, R: FromLua<'lua>>(
&'lua self,
path: impl AsRef<str>,
) -> Result<R>;
}
Expand description
Required Methods§
sourcefn path(&self) -> Result<String>
fn path(&self) -> Result<String>
Get the package.path
value
This is the value used by the lua engine to resolve require
calls on lua
files.
see:
sourcefn cpath(&self) -> Result<String>
fn cpath(&self) -> Result<String>
Get the package.cpath
value
This is the value used by the lua engine to resolve require
calls on lib
files.
see:
sourcefn prepend_path<S: AsRef<Path>>(&self, path: S) -> Result<()>
fn prepend_path<S: AsRef<Path>>(&self, path: S) -> Result<()>
Prepend a path tothe package.path
value
This is the value used by the lua engine to resolve require
calls.
see:
sourcefn prepend_paths<S: AsRef<Path>>(
&self,
paths: impl IntoIterator<Item = S>,
) -> Result<()>
fn prepend_paths<S: AsRef<Path>>( &self, paths: impl IntoIterator<Item = S>, ) -> Result<()>
Prepend paths to the package.path
value
This is the value used by the lua engine to resolve require
calls.
see:
sourcefn append_path<S: AsRef<Path>>(&self, path: S) -> Result<()>
fn append_path<S: AsRef<Path>>(&self, path: S) -> Result<()>
Append a path tothe package.path
value
This is the value used by the lua engine to resolve require
calls.
see:
sourcefn append_paths<S: AsRef<Path>>(
&self,
paths: impl IntoIterator<Item = S>,
) -> Result<()>
fn append_paths<S: AsRef<Path>>( &self, paths: impl IntoIterator<Item = S>, ) -> Result<()>
Append paths to the package.path
value
This is the value used by the lua engine to resolve require
calls.
see:
sourcefn set_path<S: AsRef<Path>>(&self, path: S) -> Result<()>
fn set_path<S: AsRef<Path>>(&self, path: S) -> Result<()>
Set the package.path
value
This is the value used by the lua engine to resolve require
calls.
see:
sourcefn set_paths<S: AsRef<Path>>(
&self,
paths: impl IntoIterator<Item = S>,
) -> Result<()>
fn set_paths<S: AsRef<Path>>( &self, paths: impl IntoIterator<Item = S>, ) -> Result<()>
Set the package.path
values
This is the value used by the lua engine to resolve require
calls.
see:
sourcefn prepend_cpath<S: AsRef<Path>>(&self, path: S) -> Result<()>
fn prepend_cpath<S: AsRef<Path>>(&self, path: S) -> Result<()>
Prepend a path tothe package.cpath
value
This is the value used by the lua engine to resolve require
calls.
see:
sourcefn prepend_cpaths<S: AsRef<Path>>(
&self,
paths: impl IntoIterator<Item = S>,
) -> Result<()>
fn prepend_cpaths<S: AsRef<Path>>( &self, paths: impl IntoIterator<Item = S>, ) -> Result<()>
Prepend paths to the package.cpath
value
This is the value used by the lua engine to resolve require
calls.
see:
sourcefn append_cpath<S: AsRef<Path>>(&self, path: S) -> Result<()>
fn append_cpath<S: AsRef<Path>>(&self, path: S) -> Result<()>
Append a path to the package.cpath
value
This is the value used by the lua engine to resolve require
calls.
see:
sourcefn append_cpaths<S: AsRef<Path>>(
&self,
paths: impl IntoIterator<Item = S>,
) -> Result<()>
fn append_cpaths<S: AsRef<Path>>( &self, paths: impl IntoIterator<Item = S>, ) -> Result<()>
Append paths to the package.cpath
value
This is the value used by the lua engine to resolve require
calls.
see:
sourcefn set_cpath<S: AsRef<Path>>(&self, path: S) -> Result<()>
fn set_cpath<S: AsRef<Path>>(&self, path: S) -> Result<()>
Set the package.cpath
value
This is the value used by the lua engine to resolve require
calls.
see:
sourcefn set_cpaths<S: AsRef<Path>>(
&self,
paths: impl IntoIterator<Item = S>,
) -> Result<()>
fn set_cpaths<S: AsRef<Path>>( &self, paths: impl IntoIterator<Item = S>, ) -> Result<()>
Set the package.cpath
values
This is the value used by the lua engine to resolve require
calls.
see:
sourcefn set_global<'lua, K, V>(&'lua self, key: K, value: V) -> Result<()>
fn set_global<'lua, K, V>(&'lua self, key: K, value: V) -> Result<()>
Set a global variable