Module:Param Parse: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
(parse a value parameter of 'N/A' as a valid option, and return 'N/A' as the output instead of a currency value) |
(Add new "unlock_profession" arg that defaults to "profession_a" but could be different (+Property:Unlock profession)) |
||
Line 672: | Line 672: | ||
-- Unlock Level |
-- Unlock Level |
||
function parse. |
function parse.unlock_profession_func(unlock_profession, profession) |
||
return parse.has_content(unlock_profession) or parse.has_content(profession) |
|||
end |
|||
function parse.unlock_level_func(unlock_profession, profession, level) |
|||
local level_valid = parse.number(level) |
local level_valid = parse.number(level) |
||
local profession_valid = parse. |
local profession_valid = parse.unlock_profession_func(unlock_profession, profession) |
||
local profession_valid_link = profession_valid |
local profession_valid_link = profession_valid |
||
Line 695: | Line 699: | ||
end |
end |
||
function parse.unlock_level_smw(profession, level) |
function parse.unlock_level_smw(unlock_profession, profession, level) |
||
local profession_valid = parse. |
local profession_valid = parse.unlock_profession_func(unlock_profession, profession) |
||
local level_valid = parse.number(level) |
local level_valid = parse.number(level) |
||
Line 709: | Line 713: | ||
return level_valid |
return level_valid |
||
end |
end |
||
parse.unlock_profession_smw = { |
|||
name = 'unlock_profession_smw', |
|||
func = {name = parse.unlock_profession_func, params = {Infobox.raw_param('unlock_profession'), Infobox.raw_param('profession_a')}}, |
|||
smw_property = 'Unlock profession', |
|||
} |
|||
parse.unlock_level = { |
parse.unlock_level = { |
||
name = 'unlock_level', |
name = 'unlock_level', |
||
func = {name = parse.unlock_level_func, params = {Infobox.raw_param('profession_a'), Infobox.raw_param('unlock_level')}}, |
func = {name = parse.unlock_level_func, params = {Infobox.raw_param('unlock_profession'), Infobox.raw_param('profession_a'), Infobox.raw_param('unlock_level')}}, |
||
smw_property = 'Unlock level', |
smw_property = 'Unlock level', |
||
smw_func = {name = parse.unlock_level_smw, params = {Infobox.raw_param('profession_a'), Infobox.raw_param('unlock_level')}}, |
smw_func = {name = parse.unlock_level_smw, params = {Infobox.raw_param('unlock_profession'), Infobox.raw_param('profession_a'), Infobox.raw_param('unlock_level')}}, |
||
category_incomplete = 'Needs unlock level', |
category_incomplete = 'Needs unlock level', |
||
} |
} |