pub trait LuaExtras {
Show 16 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<K, V>(&self, key: K, value: V) -> Result<()>
where K: IntoLua,
V: IntoLua;
fn set_global_function<K, A, R, F>(&self, key: K, value: F) -> Result<()>
where K: IntoLua,
A: FromLuaMulti,
R: IntoLuaMulti,
F: Fn(&Lua, A) -> Result<R> + Send + 'static;
}Expand description
Adds quality of life helper methods to the Lua type
Helpers:
pathandcpathmanipulation- Shorthand for
lua.globals().setthat include adding any value and adding rust functions skippingcreate_function
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<K, V>(&self, key: K, value: V) -> Result<()>
fn set_global<K, V>(&self, key: K, value: V) -> Result<()>
Set a global variable
fn set_global_function<K, A, R, F>(&self, key: K, value: F) -> Result<()>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.