Module:Cargo/doc

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.

Data parameters
Unless specified, each data entry is an array.

Field option parameters
Placed at

m_cargo.parse_field_arguments
Parses, and casts template arguments and maps them to a cargo argument table (i.e. the ones used in m_cargo.declare_factory).

The currently supported field types are:
 * FLOAT, NUMBER - cast to number
 * BOOLEAN - cast to boolean
 * LIST OF ... - cast to table

Arguments
All arguments here are expected to be passed in single table to the function.

Map arguments
All arguments supplied here are for the mapping object. Some arguments are shared with m_cargo.declare_factory.

m_cargo.map_results_to_id
Maps the results passed to a table containing the specified field as key and a table of rows for the particular page as values.

Arguments
All arguments here are expected to be passed in single table to the function.

m_cargo.array_query
Performs a long OR query from the given array and field validating that there is only exactly one match returned

Arguments
All arguments here are expected to be passed in single table to the function.

m_cargo.replace_holds
Replaces a "HOLDS" cargo query (which is currently bugged/broken) with a LIKE or REGEXP equivalent.

Arguments
All arguments here are expected to be passed in single table to the function.

m_cargo.parse_field
Parse a cargo field declaration and returns a table containing the results

Arguments
All arguments here are expected to be passed in single table to the function.

Return format
A table will be returned containing the following fields: