Module:Options
From Fallen London Wiki
Documentation for this module may be created at Module:Options/doc
local p = {}
--[[
Show all options (using the "Options" template) which were passed to the calling template
(either Storylet or Card) - no matter if there is only the "Option1" parameter, or if it goes
to Option100.
]]
function p.main(frame)
targs = frame:getParent().args
res = ""
list = {}
for k, v in pairs(targs) do
optnum = string.match(k, "^Option(%d+)$")
if (optnum) then
table.insert(list, tonumber(optnum))
end
end
table.sort(list)
for i, optnum in ipairs(list) do
res = res .. frame:expandTemplate{ title = "Options", args = {targs["Option" .. optnum]} }
end
return res
end
function p.hasNumberedParam(frame)
targs = frame:getParent().args
for k, v in pairs(targs) do
optnum = string.match(k, "^" .. frame.args[1] .. "(%d+)$")
if (optnum) then
return "true"
end
end
return ""
end
return p