Squad Wiki
Advertisement

We are introducing Cargo to the Squad wiki. This will be a learning process. On this page we collect all our learning material and learning steps.

The first real use of Cargo on the Squad Wiki is happening with the map pages - see WP - Introduce Cargo to Maps for more details.

This page is used to experiment with Cargo examples for the purpose of learning; they are not related to Squad.

All pages under Category:Learning Cargo are only used for learning Cargo; they are not related to Squad.

What is Cargo[]

In short: Cargo is a wiki extension that allows storage and retrieval of data in a database.

If you want to learn more about Cargo, check out the following resources:

Reference[]

If you want to browse our Cargo tables, check out Special:CargoTables (viewable by all users, not just admins).

Please record your general learning insights in this forum post.

There are other many Gamepedia wikis using Cargo (and Lua). Here are some examples:

General consideration with Cargo and Scribunto[]

For Scribunto/Lua specific learning, check the Learning Scribunto page. In this section we collect general insights from both Cargo and Scribunto.

We should keep the following in mind in general when working with Cargo and Scribunto/Lua:

  • Data entry: How/where do we enter the Cargo data?
  • Data maintenance: How/where do we update the Cargo data?
  • Readability: We should make it as easy for editors (and ourselves) to understand our codings - general software development guidelines apply
  • Performance: We have no experience if Cargo and Scribunto, particularly extensive use, causes any performance problems with loading a page
  • Cargo vs Lua: When should we best use just Cargo queries and when does it make sense to use Lua scripts for visualizing Cargo data?

What are the general steps when applying Cargo/Lua to a new page/item:

  1. Decide on the data elements (and their data types) you want to store and present (this might include properties that are not necessarily displayed but also important)
  2. List all pages that use this data
  3. Decide which pages will "store" the data (usually those that have infoboxes and describe the item in question) and which pages will "display" the data (usually those with overview/summary tables of that data)
  4. Decide on the specific layout/presentation of the display tables that shows the data (there might be different scenarioes/presentations/layouts for the different target pages/purposes)
  5. Create the templates for the infoboxes; these infoboxes are used for data entry; these templates use Cargo scripts for storing the data
  6. Create one Lua script to display the Cargo data; using parameter this Lua script can be made to adjust the layout/presentation of its output - this way, we only need one Lua script instead of multiples
  7. Integrate all above in the existing wiki pages
  8. Enter all the data using the infoboxes on corresponding wiki pages (if we modifiy existing infobox templates, we might already have the data on the wiki pages)

Experiments[]

Cargo Query: List authors[]

See also[]

There is also a Learning Scribunto page.

Advertisement