summaryrefslogtreecommitdiff
path: root/src/lua.rs
diff options
context:
space:
mode:
authorkyren <kerriganw@gmail.com>2017-09-14 23:27:57 -0400
committerGitHub <noreply@github.com>2017-09-14 23:27:57 -0400
commit121bac8394594cf7adb2179018ca85ce88ad9e79 (patch)
treec9f07bfc1f31278f141bd487b51d2fe155d5480a /src/lua.rs
parentd862c0f08e249d104a821a0fb1631378ea7a7db0 (diff)
parent22cbed0240977bd96f1916396469e2d670e7d70f (diff)
downloadmlua-121bac8394594cf7adb2179018ca85ce88ad9e79.zip
Merge pull request #43 from jonas-schievink/dire-dire-docs
More documentation work
Diffstat (limited to 'src/lua.rs')
-rw-r--r--src/lua.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/lua.rs b/src/lua.rs
index b0a2dda..9008b97 100644
--- a/src/lua.rs
+++ b/src/lua.rs
@@ -85,6 +85,7 @@ pub trait FromLua<'lua>: Sized {
pub struct MultiValue<'lua>(VecDeque<Value<'lua>>);
impl<'lua> MultiValue<'lua> {
+ /// Creates an empty `MultiValue` containing no values.
pub fn new() -> MultiValue<'lua> {
MultiValue(VecDeque::new())
}
@@ -436,6 +437,9 @@ impl<'lua> Table<'lua> {
}
}
+ /// Returns a reference to the metatable of this table, or `None` if no metatable is set.
+ ///
+ /// Unlike the `getmetatable` Lua function, this method ignores the `__metatable` field.
pub fn get_metatable(&self) -> Option<Table<'lua>> {
let lua = self.0.lua;
unsafe {
@@ -454,6 +458,10 @@ impl<'lua> Table<'lua> {
}
}
+ /// Sets or removes the metatable of this table.
+ ///
+ /// If `metatable` is `None`, the metatable is removed (if no metatable is set, this does
+ /// nothing).
pub fn set_metatable(&self, metatable: Option<Table<'lua>>) {
let lua = self.0.lua;
unsafe {
@@ -1177,7 +1185,7 @@ impl<'lua, T: UserData> UserDataMethods<'lua, T> {
/// Trait for custom userdata types.
///
/// By implementing this trait, a struct becomes eligible for use inside Lua code. Implementations
-/// of `ToLua` and `FromLua` are automatically provided.
+/// of [`ToLua`] and [`FromLua`] are automatically provided.
///
/// # Examples
///
@@ -1245,6 +1253,8 @@ impl<'lua, T: UserData> UserDataMethods<'lua, T> {
/// # }
/// ```
///
+/// [`ToLua`]: trait.ToLua.html
+/// [`FromLua`]: trait.FromLua.html
/// [`UserDataMethods`]: struct.UserDataMethods.html
pub trait UserData: 'static + Sized {
/// Adds custom methods and operators specific to this userdata.