Module:Cargo/doc: Difference between revisions
Jump to navigation
Jump to search
>OmegaK2 (Created page with "==Functions== ===m_cargo.declare=== This function is a simple wrapper around cargo_declare. ===m_cargo.atta...") |
>OmegaK2 |
||
Line 10: | Line 10: | ||
===m_cargo.store=== | ===m_cargo.store=== | ||
This function is a wrapper around [[mediawikiwiki:Extension:Cargo/Storing_data#Storing_data_in_a_tablee|cargo_store]]. | |||
It will cast certain native lua to acceptable values for the store. In particular: | |||
* booleans -> cast to 1 or 0 | |||
* tables -> cast to a list separated by a delimiter (default is comma) | |||
It will also avoid calling the store function if no values are passed. | |||
====Parameters==== | |||
{| class="wikitable sortable" | |||
! Parameter | |||
! Type | |||
! Description | |||
! Required | |||
! Default | |||
|- | |||
! frame | |||
| table | |||
| Frame object | |||
| {{yes}} | |||
| {{n/a}} | |||
|- | |||
! values | |||
| assoc. table | |||
| Table containing key-value pairs to store in the table. | |||
It works exactly like cargo_store, expecting the key to be the of the field and the value the value to be stored. | |||
The _table field must be supplied as well. | |||
| {{yes}} | |||
| {{n/a}} | |||
|- | |||
! args | |||
| assoc table | |||
| Additional parameters for this function | |||
| {{no}} | |||
| {{n/a}} | |||
|- | |||
! args.sep | |||
| assoc table | |||
| Table mapping the desired delimiter/separator for fields as value to the fields in question as key. | |||
| {{no}} | |||
| {{n/a}} | |||
|- | |||
! args.store_empty | |||
| boolean | |||
| Allows the storing of empty rows | |||
| {{no}} | |||
| false | |||
|- | |||
! args.debug | |||
| assoc table | |||
| If set, log the values written by this function to console | |||
| {{no}} | |||
| false | |||
|} | |||
===m_cargo.query=== | ===m_cargo.query=== |
Revision as of 18:14, 12 August 2018
Functions
m_cargo.declare
This function is a simple wrapper around cargo_declare.
m_cargo.attach
This function is a simple wrapper around cargo_attach.
m_cargo.store
This function is a wrapper around cargo_store.
It will cast certain native lua to acceptable values for the store. In particular:
- booleans -> cast to 1 or 0
- tables -> cast to a list separated by a delimiter (default is comma)
It will also avoid calling the store function if no values are passed.
Parameters
Parameter | Type | Description | Required | Default |
---|---|---|---|---|
frame | table | Frame object | ![]() |
— |
values | assoc. table | Table containing key-value pairs to store in the table.
It works exactly like cargo_store, expecting the key to be the of the field and the value the value to be stored. The _table field must be supplied as well. |
![]() |
— |
args | assoc table | Additional parameters for this function | ![]() |
— |
args.sep | assoc table | Table mapping the desired delimiter/separator for fields as value to the fields in question as key. | ![]() |
— |
args.store_empty | boolean | Allows the storing of empty rows | ![]() |
false |
args.debug | assoc table | If set, log the values written by this function to console | ![]() |
false |