Difference between revisions of "Module:Item Recipes/doc"
Jump to navigation
Jump to search
m (They see me stylin'...) |
m (Cannot concat nil value) |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 2: | Line 2: | ||
| + | |||
| + | = List of names = | ||
| + | |||
| + | <code>Module:Item Recipes</code> accepts a string as its first (unnamed) argument. This string should be the name of an item or a semicolon separated list of item names, such as: | ||
| + | |||
| + | <pre><nowiki> | ||
| + | local itemRecipes = require('Module:Item Recipes') | ||
| + | local name = 'Snowball' | ||
| + | local html = itemRecipes._itemRecipes({name}) | ||
| + | </nowiki></pre> | ||
| + | |||
| + | or: | ||
| + | |||
| + | <pre><nowiki> | ||
| + | local itemRecipes = require('Module:Item Recipes') | ||
| + | local names = '' | ||
| + | names = names .. 'Worm Composting Bin;' | ||
| + | names = names .. 'Earth Rune;' | ||
| + | names = names .. 'Scroll of Embers;' | ||
| + | names = names .. 'Stygian Bar;' | ||
| + | local html = itemRecipes._itemRecipes({names}) | ||
| + | </nowiki></pre> | ||
| + | |||
| + | The variable <code>html</code> holds a <code>mw.html</code> table and can be returned as template output. | ||
| + | |||
| + | = Named argument: ids = | ||
<code>Module:Item Recipes</code> supports the use of named argument <code>ids</code>. Using this argument, a table with item ids can be passed: | <code>Module:Item Recipes</code> supports the use of named argument <code>ids</code>. Using this argument, a table with item ids can be passed: | ||
| Line 7: | Line 33: | ||
local itemRecipes = require('Module:Item Recipes') | local itemRecipes = require('Module:Item Recipes') | ||
local tbl = { | local tbl = { | ||
| − | { ['id'] = 4510}, | + | { ['id'] = 4510 }, |
| − | { ['id'] = 511}, | + | { ['id'] = 511 }, |
| − | { ['id'] = 1601}, | + | { ['id'] = 1601 }, |
| − | { ['id'] = 207}, | + | { ['id'] = 207 }, |
} | } | ||
local html = itemRecipes._itemRecipes({['ids'] = tbl}) | local html = itemRecipes._itemRecipes({['ids'] = tbl}) | ||
</nowiki></pre> | </nowiki></pre> | ||
| − | The variable <code>html</code> holds a <code>mw.html</code> table and can be returned as template output. | + | The variable <code>html</code> holds a <code>mw.html</code> table and can be returned as template output. |
| + | |||
| + | = Sorting and collapsing = | ||
| + | |||
| + | Currently, a table with at least 8 items becomes sortable and collapsible, a table with at least 16 items auto-collapses. | ||
| + | |||
| + | = WIP = | ||
| + | |||
| + | Features planned to be added: | ||
| − | + | * Options for forcing setting whether a table is sortable, collapsible, or auto-collapses. | |
| − | + | * Support for augmenting/researching recipes. | |
| − | |||
| − | |||
| − | |||
| − | |||
[[Category:Module]] | [[Category:Module]] | ||
Latest revision as of 07:45, 25 April 2025
For basic use of Template:Item Recipes, see Template:Item Recipes/doc
List of names
Module:Item Recipes accepts a string as its first (unnamed) argument. This string should be the name of an item or a semicolon separated list of item names, such as:
local itemRecipes = require('Module:Item Recipes')
local name = 'Snowball'
local html = itemRecipes._itemRecipes({name})
or:
local itemRecipes = require('Module:Item Recipes')
local names = ''
names = names .. 'Worm Composting Bin;'
names = names .. 'Earth Rune;'
names = names .. 'Scroll of Embers;'
names = names .. 'Stygian Bar;'
local html = itemRecipes._itemRecipes({names})
The variable html holds a mw.html table and can be returned as template output.
Named argument: ids
Module:Item Recipes supports the use of named argument ids. Using this argument, a table with item ids can be passed:
local itemRecipes = require('Module:Item Recipes')
local tbl = {
{ ['id'] = 4510 },
{ ['id'] = 511 },
{ ['id'] = 1601 },
{ ['id'] = 207 },
}
local html = itemRecipes._itemRecipes({['ids'] = tbl})
The variable html holds a mw.html table and can be returned as template output.
Sorting and collapsing
Currently, a table with at least 8 items becomes sortable and collapsible, a table with at least 16 items auto-collapses.
WIP
Features planned to be added:
- Options for forcing setting whether a table is sortable, collapsible, or auto-collapses.
- Support for augmenting/researching recipes.