Module:Item Recipes/doc

From Idlescape Wiki
Jump to navigation Jump to search

This is the documentation page for Module:Item Recipes

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.