模块:ItemNames/doc
跳到导航
跳到搜索
这是模块:ItemNames的文档页面
This module makes item name and ID information available. It should not be invoked normally in article text.
The module can be called from another module with the following function:
require('Module:ItemNames').getData('<table name>', <value>)
- Returns the data for the given value from the given table. Available tables and expected values:
Code Result getData('itemNameFromId', 3279)
'Malaise'
getData('itemIdFromName', 'Malaise')
'3279'
getData('itemInternalNameFromId', 3279)
'CorruptYoyo'
getData('itemIdFromInternalName', 'CorruptYoyo')
'3279'
- Beware that item IDs are returned as strings, not integers.
The module can be called from wikitext with the following function:
{{#invoke:ItemNames| loadData | <table name> }}
- Sets variables for all items for the given table, as demonstrated above. The variable names are prefixed with the table's name. For example,
{{#invoke:ItemNames|loadData|itemNameFromId}}
sets the variables{{#var:itemNameFromId:1}}
(Iron Pickaxe
),{{#var:itemNameFromId:2}}
(Dirt Block
), and so on, up to{{#var:itemNameFromId:5455}}
(Guide to Peaceful Coexistence (Inactive)
). - This function is only intended to be called from a template (one for each table), namely:
{{itemNameFromId}}
{{itemIdFromName}}
{{itemInternalNameFromId}}
{{itemIdFromInternalName}}