Help:Cargo: Difference between revisions
Humansongs (talk | contribs) m →Storing in a table: silly butiki |
|||
| (One intermediate revision by one other user not shown) | |||
| Line 4: | Line 4: | ||
==Storing data with Cargo== | ==Storing data with Cargo== | ||
Unlike a wikitext table, it is not possible for any user (even admins) to "edit" a Cargo table in the traditional sense. The only way to store data in a Cargo table is by using the <code><nowiki>{{#cargo_store}}</nowiki></code> parser function within a template (or a Lua module). This means adding, removing, or changing values in a table requires editing a template call on a page. For example, in order to change the cost of the "Perma-Spike" upgrade in the <code>btd6_upgrades</code> table, one needs to edit the <code>cost</code> parameter in the <code><nowiki>{{BTD6 upgrade info}}</nowiki></code> template call on the [[Perma-Spike (BTD6)]] page, because the <code><nowiki>{{BTD6 upgrade info}}</nowiki></code> template call on that page is what stores the information about that upgrade to the Cargo table. | |||
A template also needs to either declare the cargo table it will store content into, or attach itself to a cargo table that's defined in another template. For example, <code><nowiki>{{BTD6 upgrade info}}</nowiki></code> is an infobox template that both declares the <code>btd6_upgrades</code> cargo table and stores the info for all those upgrades using template parameters. | |||
There are two major steps to setting up a cargo table: declaring the table and storing content in the table. This guide assumes you already know [[Help:Templates|how to create templates]]. | There are two major steps to setting up a cargo table: declaring the table and storing content in the table. This guide assumes you already know [[Help:Templates|how to create templates]]. | ||
| Line 68: | Line 70: | ||
|character_upgrade_required={{{character upgrade required|}}} | |character_upgrade_required={{{character upgrade required|}}} | ||
}}</pre> | }}</pre> | ||
The syntax is similar to a template call, except each parameter specifies which template parameters should pass their values into each column of the table. For example, [[Slicer]] | The syntax is similar to a template call, except each parameter specifies which template parameters should pass their values into each column of the table. For example, [[Slicer]] uses these parameters: | ||
<pre>{{BATTD upgrade info | <pre>{{BATTD upgrade info | ||
|id=slicer | |id=slicer | ||