Template:Type: Difference between revisions

From FiguraMC
PenguinEncounter (talk | contribs)
No edit summary
Tag: 2017 source edit
PenguinEncounter (talk | contribs)
No edit summary
Tag: 2017 source edit
 
(15 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<includeonly><templatestyles src="Template:Type/style.css"/>{{#if:{{{3|{{{link|}}}}}}
<includeonly><templatestyles src="Template:Type/style.css"/>{{#invoke:Type|run}}</includeonly><noinclude> <!-- Documentation starts here. -->
|{{type/link|{{{1}}}|mod={{{2|{{{mod}}}}}}|link={{{3|{{{link}}}}}}}}
|{{#switch:{{{1}}}
| nil = {{type/builtin|{{{1}}}|mod={{{2|{{{mod}}}}}}}}
| number = {{type/builtin|{{{1}}}|mod={{{2|{{{mod}}}}}}}}
| integer = {{type/builtin|{{{1}}}|mod={{{2|{{{mod}}}}}}}}
| string = {{type/builtin|{{{1}}}|mod={{{2|{{{mod}}}}}}}}
| boolean = {{type/builtin|{{{1}}}|mod={{{2|{{{mod}}}}}}}}
| true = {{type/builtin|{{{1}}}|mod={{{2|{{{mod}}}}}}}}
| false = {{type/builtin|{{{1}}}|mod={{{2|{{{mod}}}}}}}}
| function = {{type/builtin|{{{1}}}|mod={{{2|{{{mod}}}}}}}}
| table = {{type/builtin|{{{1}}}|mod={{{2|{{{mod}}}}}}}}
| {{type/custom|{{{1}}}|mod={{{2|{{{mod}}}}}}}}
  }}
}}</includeonly><noinclude> <!-- Documentation starts here. -->
'''Displays a ''type widget''.'''
'''Displays a ''type widget''.'''


Chooses between...
* All options are routed through [[Module:Type]]. (Edit to add aliases or custom links for matching types.)
* If argument 2 is provided, [[Template:Type/link|use that as the link target]].
* Stylesheet: [[Template:Type/style.css]]. (Edit to add colors and decorations for custom types.)
* Specialized template for [[Template:Type/builtin|built-in Lua types]].
* Specialized template for [[Template:Type/custom|custom Figura types]]. If the page with <code>[argument 1] (type)</code> (i.e. disambiguated) exists, that page will be used instead of the plain name for the link.
 
Stylesheet: [[Template:Type/style.css]] (edit to add colors and decorations for custom types)


== Examples ==
== Examples ==
* {{type|nil}} <code><nowiki>{{type|nil}}</nowiki></code>
* {{type|nil}} <code><nowiki>{{type|nil}}</nowiki></code>
* {{type|number}}
* {{type|number}}
* {{type|number|?}} (optional number)
* {{type|numbers|?}} (optional number)
* {{type|string}}
* {{type|string}}
* {{type|boolean}}
* {{type|boolean}}
* {{type|function}}
* {{type|function}}
* {{type|table}}
* {{type|table}}
* {{type|Vector}} ({{type|Vector2}}, {{type|Vector3}}, {{type|Vector4}})
* {{type|Matrix}} ({{type|Matrix2}}, {{type|Matrix3}}, {{type|Matrix4}})
* {{type|Event}} (custom type that exists)
* {{type|Event}} (custom type that exists)
* {{type|CrashAPI}} (custom type that doesn't exist)
* {{type|CrashAPI}} (custom type that doesn't exist)
* {{type|Main Page|Main Page}} (links to the [[Main Page]]) <code><nowiki>{{type|Main Page|Main Page}}</nowiki></code>
* {{type|Main Page|link=Event}} (links to [[Event]]) <code><nowiki>{{type|Main Page|link=Event}}</nowiki></code>
[[Template:Type/testcases|Testcases page.]]
[[Template:Type/testcases|Testcases page.]]
<templatedata>
<templatedata>
Line 47: Line 31:
"string",
"string",
"function",
"function",
"table"
"table",
"Vector",
"Matrix"
],
],
"required": true
"required": true,
"aliases": [
"name"
],
"description": "Type name ('table' etc.) Supports modifiers, like ? and [].",
"type": "string"
},
"2": {
"description": "Type modifiers (compatibility)",
"deprecated": "Attach modifiers directly to the type name."
},
},
"link": {
"link": {
"aliases": [
"3"
],
"label": "Custom link target",
"label": "Custom link target",
"type": "wiki-page-name"
"type": "wiki-page-name"
},
},
"mod": {
"text": {
"aliases": [
"label": "Custom text",
"2"
"description": "If provided, this text will be displayed instead of the type name. The link and styling will still be determined by the type name.",
],
"type": "content"
"label": "Type modifiers",
"description": "Modifiers to the type, like array / optional",
"type": "content",
"suggestedvalues": [
"[]",
"?",
"[]?"
]
}
}
},
},
Line 75: Line 59:
"paramOrder": [
"paramOrder": [
"1",
"1",
"mod",
"link",
"link"
"text",
"2"
],
],
"format": "inline"
"format": "inline"
}
}
</templatedata></noinclude>
</templatedata></noinclude>

Latest revision as of 20:20, 28 September 2024

Displays a type widget.

  • All options are routed through Module:Type. (Edit to add aliases or custom links for matching types.)
  • Stylesheet: Template:Type/style.css. (Edit to add colors and decorations for custom types.)

Examples

  • nil {{type|nil}}
  • number
  • numbers | nil (optional number)
  • string
  • boolean
  • function
  • table
  • Vector (Vector2, Vector3, Vector4)
  • Matrix (Matrix2, Matrix3, Matrix4)
  • Event (custom type that exists)
  • CrashAPI (custom type that doesn't exist)
  • Main Page (links to Event) {{type|Main Page|link=Event}}

Testcases page.

Displays and links to types.

Template parameters[Edit template data]

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Type name1 name

Type name ('table' etc.) Supports modifiers, like ? and [].

Suggested values
nil boolean integer number string function table Vector Matrix
Stringrequired
Custom link targetlink

no description

Page nameoptional
Custom texttext

If provided, this text will be displayed instead of the type name. The link and styling will still be determined by the type name.

Contentoptional
22

Type modifiers (compatibility)

Unknowndeprecated