Module:RecursiveSelectiveList: Difference between revisions

From Ikwipedia
No edit summary
No edit summary
Line 1: Line 1:
local p = {}
local categoryName = frame.args.categoryName or "Category:Example"
 
return "Debug: Attempting to fetch members for " .. categoryName
function p.main(frame)
    local categoryName = frame.args.categoryName or "Category:Books" -- Default category
    local limit = tonumber(frame.args.limit) or 10 -- Default limit
 
    local category = mw.title.new(categoryName)
    if not category or not category.exists then
        return "Error: The specified category does not exist."
    end
 
    local members = category:members()
    local result = {}
    local count = 0
 
    for page in members do
        table.insert(result, "* [[" .. page.title .. "]]")
        count = count + 1
        if count >= limit then
            break
        end
    end
 
    return table.concat(result, "\n")
end
 
return p

Revision as of 07:27, 22 December 2024

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

local categoryName = frame.args.categoryName or "Category:Example"
return "Debug: Attempting to fetch members for " .. categoryName