View source for Module:CountryData
You do not have permission to edit this page, for the following reason:
You can view and copy the source of this page.
local p = {}
local function getcontents(frame,country,params)
return frame:expandTemplate({title="Country data "..country;args=params})
end
function p.gettable(frame,country,params)
--Returns the parameters of a country data template as a Lua table
--If not a valid data template, return empty table
local bool, s = pcall(getcontents,frame,country,params or {})
if bool and string.find(s,"^%{%{ *%{%{%{1")
then
--Replace parameter delimiters with arbitrary control characters
--to avoid clashes if param values contain equals/pipe signs
s = string.gsub(s,"|([^|=]-)=","\1\1%1\2")
s = string.gsub(s,"}}%s*$","\1")
--Loop over string and add params to table
local part = {}
for par in string.gmatch(s,"\1[^\1\2]-\2[^\1\2]-\1") do
local k = string.match(par,"\1%s*(.-)%s*\2")
000
1:0
Template used on this page:
Return to Module:CountryData.