Difference between revisions of "Module:Item Recipes/doc"

From Idlescape Wiki
Jump to navigation Jump to search
(Add to Category:Module)
 
m (Cannot concat nil value)
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
''For basic use of <code>Template:Item Recipes</code>, see [[Template:Item Recipes/doc]]''
 +
 +
 +
 +
= 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:
 +
<pre><nowiki>
 +
local itemRecipes = require('Module:Item Recipes')
 +
local tbl = {
 +
    { ['id'] = 4510 },
 +
    { ['id'] = 511 },
 +
    { ['id'] = 1601 },
 +
    { ['id'] = 207 },
 +
}
 +
local html = itemRecipes._itemRecipes({['ids'] = tbl})
 +
</nowiki></pre>
 +
 +
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.