summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJonas Schievink <jonasschievink@gmail.com>2018-01-26 19:44:35 +0100
committerJonas Schievink <jonasschievink@gmail.com>2018-01-26 19:44:35 +0100
commit0a4ae8d859a150eab29007c8579edea73521076b (patch)
tree2790b61aa799d9ec618ccb29ec628f720108654f /src
parent79b028419fc40ee751b7b6b1c724371c0b501d77 (diff)
downloadmlua-0a4ae8d859a150eab29007c8579edea73521076b.zip
Additional `MetaMethod` docs
Diffstat (limited to 'src')
-rw-r--r--src/userdata.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/userdata.rs b/src/userdata.rs
index 98ec717..aac80df 100644
--- a/src/userdata.rs
+++ b/src/userdata.rs
@@ -11,6 +11,11 @@ use value::{FromLua, FromLuaMulti, ToLuaMulti};
use lua::Lua;
/// Kinds of metamethods that can be overridden.
+///
+/// For safety reasons, this mechanism does not allow overriding the `__gc` metamethod. [`UserData`]
+/// implementors can instead just use `Drop`.
+///
+/// [`UserData`]: trait.UserData.html
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
pub enum MetaMethod {
/// The `+` operator.
@@ -57,7 +62,9 @@ pub enum MetaMethod {
NewIndex,
/// The call "operator" `obj(arg1, args2, ...)`.
Call,
- /// tostring(ud) will call this if it exists
+ /// The `__tostring` metamethod.
+ ///
+ /// This is not an operator, but will be called by methods such as `tostring` and `print`.
ToString,
}