summaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorAlex Orlenko <zxteam@protonmail.com>2021-11-25 15:43:28 +0000
committerAlex Orlenko <zxteam@protonmail.com>2021-11-25 18:01:41 +0000
commit2fee3e7891b7370ad83b9bdca14554f3a2d46bf3 (patch)
tree6139c90503d8c7f3ef73067d8b03ca96e40c5c96 /src/lib.rs
parent9f073ad879eb37a8e3beb98d182b48384e6d15a9 (diff)
downloadmlua-2fee3e7891b7370ad83b9bdca14554f3a2d46bf3.zip
Update docs
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 567873b..f89154a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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;