Difference between revisions of "Module:Item Recipes/doc"
Jump to navigation
Jump to search
m (Explain return value explicitly in first use case) |
m (Cannot concat nil value) |
||
| Line 17: | Line 17: | ||
<pre><nowiki> | <pre><nowiki> | ||
local itemRecipes = require('Module:Item Recipes') | local itemRecipes = require('Module:Item Recipes') | ||
| − | local names | + | local names = '' |
names = names .. 'Worm Composting Bin;' | names = names .. 'Worm Composting Bin;' | ||
names = names .. 'Earth Rune;' | names = names .. 'Earth Rune;' | ||
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.