diff options
author | Alex Orlenko <zxteam@protonmail.com> | 2021-11-25 15:43:28 +0000 |
---|---|---|
committer | Alex Orlenko <zxteam@protonmail.com> | 2021-11-25 18:01:41 +0000 |
commit | 2fee3e7891b7370ad83b9bdca14554f3a2d46bf3 (patch) | |
tree | 6139c90503d8c7f3ef73067d8b03ca96e40c5c96 /src/lib.rs | |
parent | 9f073ad879eb37a8e3beb98d182b48384e6d15a9 (diff) | |
download | mlua-2fee3e7891b7370ad83b9bdca14554f3a2d46bf3.zip |
Update docs
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -192,6 +192,23 @@ extern crate mlua_derive; #[cfg_attr(docsrs, doc(cfg(feature = "macros")))] pub use mlua_derive::chunk; -#[cfg(any(feature = "module"))] +/// Registers Lua module entrypoint. +/// +/// You can register multiple entrypoints as required. +/// +/// ``` +/// use mlua::{Lua, Result, Table}; +/// +/// #[mlua::lua_module] +/// fn my_module(lua: &Lua) -> Result<Table> { +/// let exports = lua.create_table()?; +/// exports.set("hello", "world")?; +/// Ok(exports) +/// } +/// ``` +/// +/// Internally in the code above the compiler defines C function `luaopen_my_module`. +/// +#[cfg(any(feature = "module", docsrs))] #[cfg_attr(docsrs, doc(cfg(feature = "module")))] pub use mlua_derive::lua_module; |