Difference between revisions of "Template:Load"
Jump to navigation
Jump to search
Kevin Wang (talk | contribs) (Created page with " {{#vardefine:load_i|1}}{{#while:|{{{{{#var:load_i}}|}}}|{{#vardefine:{{{ {{#var:load_i}} }}}|{{#var:prev_{{{ {{#var:load_i}} }}}}}}}{{#vardefine:load_i|{{#expr:{{#var:load_i}...") |
Kevin Wang (talk | contribs) m |
||
| Line 1: | Line 1: | ||
| − | + | <includeonly>{{#vardefine:load_i|1}}{{#while:|{{{{{#var:load_i}}|}}}|{{#vardefine:{{{ {{#var:load_i}} }}}|{{#var:prev_{{{ {{#var:load_i}} }}}}}}}{{#vardefine:load_i|{{#expr:{{#var:load_i}}+1}}}}}}</includeonly><noinclude> | |
| − | {{#vardefine:load_i|1}}{{#while:|{{{{{#var:load_i}}|}}}|{{#vardefine:{{{ {{#var:load_i}} }}}|{{#var:prev_{{{ {{#var:load_i}} }}}}}}}{{#vardefine:load_i|{{#expr:{{#var:load_i}}+1}}}}}}<noinclude>Given a list of variable names {x1, x2, x3, ...}, set the value of those variables to the values of {prev_x1, prev_x2, prev_x3}. | + | {{Template doc| |
| + | Given a list of variable names {x1, x2, x3, ...}, set the value of those variables to the values of {prev_x1, prev_x2, prev_x3}. | ||
Use this template to restore the variables of a page; should be used with [[Template:Save]]. | Use this template to restore the variables of a page; should be used with [[Template:Save]]. | ||
Example: | Example: | ||
| − | + | <pre> | |
| − | |||
| − | |||
| − | |||
| − | |||
{{#vardefine:x|1}}{{#vardefine:y|2}}{{#vardefine:z|blue}} | {{#vardefine:x|1}}{{#vardefine:y|2}}{{#vardefine:z|blue}} | ||
{{Save|x|y|z}} | {{Save|x|y|z}} | ||
| Line 17: | Line 14: | ||
{{#var:x}}, {{#var:y}}, {{#var:z}} | {{#var:x}}, {{#var:y}}, {{#var:z}} | ||
</pre> | </pre> | ||
| − | |||
{{#vardefine:x|1}}{{#vardefine:y|2}}{{#vardefine:z|blue}} | {{#vardefine:x|1}}{{#vardefine:y|2}}{{#vardefine:z|blue}} | ||
{{Save|x|y|z}} | {{Save|x|y|z}} | ||
| Line 24: | Line 20: | ||
{{Load|x|y|z}} | {{Load|x|y|z}} | ||
{{#var:x}}, {{#var:y}}, {{#var:z}} | {{#var:x}}, {{#var:y}}, {{#var:z}} | ||
| − | + | }}</noinclude> | |
| − | </noinclude> | ||
Latest revision as of 18:10, 14 December 2025
Template documentation
Given a list of variable names {x1, x2, x3, ...}, set the value of those variables to the values of {prev_x1, prev_x2, prev_x3}.
Use this template to restore the variables of a page; should be used with Template:Save.
Example:
{{#vardefine:x|1}}{{#vardefine:y|2}}{{#vardefine:z|blue}}
{{Save|x|y|z}}
{{#vardefine:x|1a}}{{#vardefine:y|2a}}{{#vardefine:z|red}}
{{#var:x}}, {{#var:y}}, {{#var:z}}
{{Load|x|y|z}}
{{#var:x}}, {{#var:y}}, {{#var:z}}
1a, 2a, red
1, 2, blue