Module:ModuleShowVariantsOrSingle: Difference between revisions

From The First Descendant Wiki
(Created page with "------------------------------------ -- Modules can have variants, or they can be one of a kind. -- It doesn't make sense to show all the variant fluff if a module is one of a kind. local p = {} function p.processData(frame) if frame.args.count == nil then return "ERROR: Module:ModuleShowVariantsOrSingle not passed a count. Please tell us on Discord!" end return frame.args.count --return frame:preprocess(completedTable) end return p")
 
No edit summary
Line 4: Line 4:


local p = {}
local p = {}
local function moreThanOne(module_name)
    local variants_chapter = [[
        == Variants ==
        {{Template:ModuleTableCompareLevels
        | module_name = ]] .. module_name .. "}}"
    return variants_chapter
end




Line 12: Line 21:
     end
     end
      
      
     return frame.args.count
     local result = ""
     --return frame:preprocess(completedTable)
    if frame.args.count > 1 then
        result = moreThanOne(frame.args.module_name)
    end
 
     return frame:preprocess(result)
end
end


return p
return p

Revision as of 21:45, 5 June 2024

Documentation for this module may be created at Module:ModuleShowVariantsOrSingle/doc

------------------------------------
-- Modules can have variants, or they can be one of a kind.
-- It doesn't make sense to show all the variant fluff if a module is one of a kind.

local p = {}


local function moreThanOne(module_name)
    local variants_chapter = [[
        == Variants ==
        {{Template:ModuleTableCompareLevels
        | module_name = ]] .. module_name .. "}}"
    return variants_chapter
end



function p.processData(frame)
    if frame.args.count == nil then
        return "ERROR: Module:ModuleShowVariantsOrSingle not passed a count. Please tell us on Discord!"
    end
    
    local result = ""
    if frame.args.count > 1 then
        result = moreThanOne(frame.args.module_name)
    end

    return frame:preprocess(result)
end

return p