Module:ItemData/nav: Difference between revisionsGive feedback
Jump to navigation
Jump to search
m write_item_slot_subgroup fixed group and list number starting at 1 instead of 2 |
m write_item_slot_subgroup created type parameter |
||
| Line 63: | Line 63: | ||
-- for [[Template:Item Navbox]] | -- for [[Template:Item Navbox]] | ||
function p.get_item_nav_bulletpoints( | function p.get_item_nav_bulletpoints(slot, min_souls, max_souls, debug_mode) | ||
-- If called internally (direct Lua call), args will be passed directly. | |||
-- If called from wikitext, `slot` will be the `frame` object, and we get args from `frame.args`. | |||
-- Handle the case where it's called via #invoke (i.e., from wikitext) | |||
if type(slot) == "table" and slot.args then | |||
local frame = slot | |||
slot = frame.args[1] | |||
debug_mode = frame.args["debug_mode"] | |||
end | |||
local left_wrap = '{{ItemIcon|' | local left_wrap = '{{ItemIcon|' | ||
local right_wrap = '}}' | local right_wrap = '}}' | ||
| Line 100: | Line 106: | ||
function p.write_item_slot_subgroup(frame) | function p.write_item_slot_subgroup(frame) | ||
local slot = frame.args[1] | local slot = frame.args[1] | ||
local type = frame.args[2] | |||
local debug_mode = frame.args['debug_mode'] | local debug_mode = frame.args['debug_mode'] | ||
if slot == nil then return "'slot' parameter is required" end | if slot == nil then return "'slot' parameter is required" end | ||
| Line 121: | Line 128: | ||
--Create the subgroup | --Create the subgroup | ||
ret = ret .. "|group" .. (i-1) .. "={{Souls|"..souls.."|Shadow="..soul_style.."}}" | ret = ret .. "|group" .. (i-1) .. "={{Souls|"..souls.."|Shadow="..soul_style.."}}" | ||
ret = ret .. "|list" .. (i-1) .. "=" .. | local list | ||
if type=='get_item_nav_cards' then | |||
list = p.get_item_nav_cards(slot, min_souls, max_souls, debug_mode) | |||
elseif type=='get_item_nav_bulletpoints' then | |||
list = p.get_item_nav_bulletpoints(slot, min_souls, max_souls, debug_mode) | |||
else | |||
return "'type' should be get_item_nav_cards or get_item_nav_bulletpoints" | |||
end | |||
ret = ret .. "|list" .. (i-1) .. "=" .. list | |||
end | end | ||
end | end | ||