Module:Common: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 3: | Line 3: | ||
function p.SiteAllP() | function p.SiteAllP() | ||
local MaxP = 20 | local MaxP = 20 | ||
local Separator = "|" | |||
local AllP = {} | local AllP = {} | ||
local PDetails = {} | |||
for PNumber = 1, MaxP, 1 do | for PNumber = 1, MaxP, 1 do | ||
if mw.wikibase.entityExists('P' .. PNumber) then | if mw.wikibase.entityExists('P' .. PNumber) then | ||
AllP[#AllP + 1] = 'P' .. PNumber | local PDetails = {} | ||
local Property = mw.wikibase.getEntity('P' .. PNumber) | |||
PDetails[#PDetails + 1] = 'P' .. PNumber | |||
PDetails[#PDetails + 1] = Property.type | |||
--AllP[#AllP + 1] = 'P' .. PNumber | |||
AllP[#AllP + 1] = table.concat(PDetails, Separator) | |||
end | end | ||
end | end |
Revision as of 00:17, 10 June 2020
Documentation for this module may be created at Module:Common/doc
-- Keyword: wikitrek
local p = {}
function p.SiteAllP()
local MaxP = 20
local Separator = "|"
local AllP = {}
local PDetails = {}
for PNumber = 1, MaxP, 1 do
if mw.wikibase.entityExists('P' .. PNumber) then
local PDetails = {}
local Property = mw.wikibase.getEntity('P' .. PNumber)
PDetails[#PDetails + 1] = 'P' .. PNumber
PDetails[#PDetails + 1] = Property.type
--AllP[#AllP + 1] = 'P' .. PNumber
AllP[#AllP + 1] = table.concat(PDetails, Separator)
end
end
return table.concat(AllP, "<br />" .. string.char(10))
end
return p