Template:Type: Difference between revisions

From FiguraMC
PenguinEncounter (talk | contribs)
No edit summary
Tag: 2017 source edit
PenguinEncounter (talk | contribs)
Update template data
Tag: 2017 source edit
Line 2: Line 2:
'''Displays a ''type widget''.'''
'''Displays a ''type widget''.'''


* If a link is provided: [[Template:Type/link]]
* All options are routed through [[Module:Type]].
* Built-in types: [[Template:Type/builtin]]
* Custom types (fallback): [[Template:Type/custom]]. 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)
Stylesheet: [[Template:Type/style.css]] (edit to add colors and decorations for custom types)
Line 35: Line 33:
"function",
"function",
"table",
"table",
                "Vector",
"Vector",
                "Matrix"
"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 64: Line 60:
"paramOrder": [
"paramOrder": [
"1",
"1",
"mod",
"link",
"link"
"text",
"2"
],
],
"format": "inline"
"format": "inline"
}
}
</templatedata></noinclude>
</templatedata></noinclude>

Revision as of 20:10, 28 September 2024

Displays a type widget.

Stylesheet: Template:Type/style.css (edit to add colors and decorations for custom types)

Examples

  • nil {{type|nil}}
  • number
  • number | 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