Joritochip (talk | contribs) mNo edit summary Tag: Source edit |
Joritochip (talk | contribs) mNo edit summary Tag: Source edit |
||
Line 17: | Line 17: | ||
-- @return {string} Wikitext for list of players. |
-- @return {string} Wikitext for list of players. |
||
function p._player_list(args) |
function p._player_list(args) |
||
− | local items = {"test"} |
+ | local items = {"test", #args} |
if #args <= 90 then |
if #args <= 90 then |
||
for _, name in ipairs(args) do |
for _, name in ipairs(args) do |
Revision as of 15:56, 8 October 2020
Functions for making lists of players
Documentation
Package items
player_list._player_list(args)
(function)- Create an unordered list of players with links. This function makes an attempt to avoid exceeding the expensive function limit.
- Parameter:
args
A table with player names as values. (table) - Returns: Wikitext for list of players. (string)
--- Functions for making lists of players
-- @require Module:Links
-- @require Module:Player link
-- @require Module:RobloxUrls
-- @require Module:Utils
-- <nowiki>
local links = require("Module:Links")
local player_link = require("Module:Player link")
local roblox_urls = require("Module:RobloxUrls")
local utils = require("Module:Utils")
local p = {}
--- Create an unordered list of players with links.
-- This function makes an attempt to avoid exceeding the expensive function limit.
-- @param {table} args A table with player names as values.
-- @return {string} Wikitext for list of players.
function p._player_list(args)
local items = {"test", #args}
if #args <= 90 then
for _, name in ipairs(args) do
local item = "* " .. player_link._player_link{player = name}
table.insert(items, item)
end
else
local pages = mw.loadData('Module:Player pages')
local page_set = utils.array_to_set(pages)
return pages.concat(" ") -- test
--[[for _, name in ipairs(args) do
if page_set[name] then
local item = "* " .. links.wikilink('Community:'..name, name)
table.insert(items, item)
else
local item = "* " .. links.external_link(roblox_urls.user_from_username(name), name)
table.insert(items, item)
end
end]]
end
return table.concat(items, "\n")
end
p.player_list = utils.make_wrapper_function(p._player_list)
return p