Add links to lua pdf in metamethod doc

This commit is contained in:
lumi 2025-06-26 23:08:28 +10:00
parent 6a194e98e8
commit 862fcfe891
Signed by: luaneko
GPG Key ID: 406809B8763FF07A

View File

@ -821,28 +821,31 @@ fn document_async(func: &mut ImplItemFn) {
fn document_metamethod(func: &mut ImplItemFn, method: Metamethod) { fn document_metamethod(func: &mut ImplItemFn, method: Metamethod) {
let s = match method { let s = match method {
Metamethod::Eq => "This is a metamethod which is called by the `==` operator.".into(), Metamethod::Eq => "This is a metamethod which is called by the `==` operator.",
Metamethod::Len => "This is a metamethod which is called by the `#` operator.".into(), Metamethod::Len => "This is a metamethod which is called by the `#` operator.",
Metamethod::Lt => "This is a metamethod which is called by the `<` operator.".into(), Metamethod::Lt => "This is a metamethod which is called by the `<` operator.",
Metamethod::Le => "This is a metamethod which is called by the `<=` operator.".into(), Metamethod::Le => "This is a metamethod which is called by the `<=` operator.",
Metamethod::Concat => "This is a metamethod which is called by the `..` operator.".into(), Metamethod::Concat => "This is a metamethod which is called by the `..` operator.",
Metamethod::Add => "This is a metamethod which is called by the `+` operator.".into(), Metamethod::Call => {
Metamethod::Sub => "This is a metamethod which is called by the `-` operator.".into(), "This is a metamethod which can be called by calling `(...)` on the value directly."
Metamethod::Mul => "This is a metamethod which is called by the `*` operator.".into(), }
Metamethod::Div => "This is a metamethod which is called by the `/` operator.".into(), Metamethod::Add => "This is a metamethod which is called by the `+` operator.",
Metamethod::Mod => "This is a metamethod which is called by the `%` operator.".into(), Metamethod::Sub => "This is a metamethod which is called by the `-` operator.",
Metamethod::Pow => "This is a metamethod which is called by the `^` operator.".into(), Metamethod::Mul => "This is a metamethod which is called by the `*` operator.",
Metamethod::Unm => "This is a metamethod which is called by the `-` operator.".into(), Metamethod::Div => "This is a metamethod which is called by the `/` operator.",
Metamethod::Mod => "This is a metamethod which is called by the `%` operator.",
Metamethod::Pow => "This is a metamethod which is called by the `^` operator.",
Metamethod::Unm => "This is a metamethod which is called by the `-` operator.",
Metamethod::ToString => { Metamethod::ToString => {
"This is a metamethod which can be called by the `tostring` built-in function.".into() "This is a metamethod which is called by the [`tostring(...)`](https://www.lua.org/manual/5.1/manual.html#pdf-tostring) built-in function."
} }
Metamethod::Pairs => { Metamethod::Pairs => {
"This is a metamethod which can be called by the `pairs` built-in function.".into() "This is a metamethod which is called by the [`pairs(...)`](https://www.lua.org/manual/5.1/manual.html#pdf-pairs) built-in function."
} }
Metamethod::Ipairs => { Metamethod::Ipairs => {
"This is a metamethod which can be called by the `ipairs` built-in function.".into() "This is a metamethod which is called by the [`ipairs(...)`](https://www.lua.org/manual/5.1/manual.html#pdf-ipairs) built-in function."
} }
_ => format!("This is a metamethod and cannot be called directly."), _ => "This is a metamethod and cannot be called directly.",
}; };
func.attrs.insert(0, parse_quote!(#[doc = func.attrs.insert(0, parse_quote!(#[doc =