Module:Userbox/sandbox/doc: Difference between revisions
From Kenshi Wiki
More actions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
<includeonly> | <includeonly> | ||
{{Module:Userbox/ | {{Lua|Module:Category handler|Module:Arguments|Module:Color contrast}} | ||
This module does the processing for three userbox templates, {{tl|userbox}}, {{tl|userbox-2}} and {{tl|userbox-r}}. | |||
{| class="wikitable" | |||
|- | |||
! Template | |||
! Description | |||
! Examples | |||
|- | |||
| {{tl|userbox}} | |||
| Makes userboxes with an id on the left-hand side, or with no id. | |||
| {{userbox|id=id}} | |||
{{clear}} | |||
{{userbox}} | |||
|- | |||
| {{tl|userbox-2}} | |||
| Makes userboxes with an id on both the left- and right-hand sides. | |||
| {{userbox-2}} | |||
|- | |||
| {{tl|userbox-r}} | |||
| Makes userboxes with an id on the right-hand side. | |||
| {{userbox-r}} | |||
|} | |||
To use any of these templates from a wiki page, please see the individual template pages for documentation. To generate userboxes directly from Lua, read on. | |||
== Generating userboxes from Lua == | |||
To generate a userbox directly from Lua, first load the module. | |||
<syntaxhighlight lang="lua"> | |||
local userbox = require('Module:Userbox') | |||
</syntaxhighlight> | |||
You can then run any of the three templates with the code: | |||
<syntaxhighlight lang="lua"> | |||
userbox.main(functionName, args) | |||
</syntaxhighlight> | |||
For {{tl|userbox}} use the function name "<code>_userbox</code>"; for {{tl|userbox-2}} use the function name "<code>_userbox-2</code>"; and for {{tl|userbox-r}} use the function name "<code>_userbox-r</code>". The <code>args</code> parameter is a table of arguments to pass to the different userbox functions. To see a list of valid arguments, please consult the individual template pages. | |||
== Tracking categories == | |||
* {{clc|Userboxes with insufficient color contrast}} | |||
* {{clc|Pages with templates in the wrong namespace}} | |||
[[Category:Module sandboxes]] | [[Category:Module sandboxes]] | ||
[[Category:Module sand&test]] | [[Category:Module sand&test]] |
Latest revision as of 22:38, 14 March 2025
- Sandbox1 for Module:Userbox