Module:File link/doc: Difference between revisions
From Mariopedia, a wiki on Mario, Yoshi, Wario, Donkey Kong, Super Smash Bros., and more!
Jump to navigationJump to search
Content deleted Content added
m →Usage: fix language |
add three methods |
||
Line 40: | Line 40: | ||
</source> |
</source> |
||
Apart from the <code>name</code> method, all of the object's methods support |
Apart from the <code>name</code> method, all of the object's methods support nil as an input, so call-chaining can be performed with variables whose value is unknown. However, an error will be raised if the input is of an unsupported type for that method. Please see [[#Methods|the Methods section]] for supported input types for each method. Passing nil to a method will overwrite any existing values. |
||
=== Use with tostring === |
=== Use with tostring === |
||
Line 50: | Line 50: | ||
tostring(obj) |
tostring(obj) |
||
</source> |
</source> |
||
== Methods == |
|||
=== Name === |
|||
<source lang="lua"> |
|||
obj:name(s) |
|||
</source> |
|||
Sets the filename. <var>s</var> must be a string. Nil values are not accepted, as every file link requires a filename. The filename can also be set in the first parameter to <code>fileLink.new</code>, although in that case it is optional. |
|||
=== Format === |
|||
<source lang="lua"> |
|||
obj:format(s, filename) |
|||
</source> |
|||
Sets the display format. <var>s</var> must either be nil, or one of the strings 'thumb', 'thumbnail', 'frame', 'framed', or 'frameless'. To see the effect of each of these options, see the [[mw:Help:Images#Format|images help page on mediawiki.org]]. Note that the ''border'' format is not set with this method, but with the [[#Border|border method]]. (This is because the border option can be set independently of the values that can be set with this method, for example in the code <code><nowiki>[[File:Example.png|frameless|border|caption]]</nowiki></code>.) |
|||
=== Border === |
|||
<source lang="lua"> |
|||
obj:border(hasBorder) |
|||
</source> |
|||
Sets a border for the image. <var>hasBorder</var> must either be nil, or a boolean value. A border will be set if <var>hasBorder</var> is true. To see the effect of this option, see the [[mw:Help:Images#Format|images help page on mediawiki.org]]. |
|||
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox|| |
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox|| |