Script error: The function "main" does not exist.
--[[
{{#invoke:Sandbox/Chao|GallerySection|character=Noel Vermillion|section=Portraits}}
simulate passing a frame to the function in the console with:
myFrame = { args = { character='Noel Vermillion', section='Portraits' } }
=p.GallerySection ( myFrame )
--]]
local p = {}
local cargo = mw.ext.cargo
function p.testExpandTemplate(frame)
return frame:expandTemplate{ title = 'h', args = { '|' } }
end
function p.GallerySection(frame)
_character = frame.args.character or ''
_source = frame.args.source or ''
_section = frame.args.section or ''
_limit = frame.args.limit or 4
_title = frame.args.title or ''
_header = frame.args.header or ''
_see_all = frame.args.see_all or ''
_see_cameo = frame.args.see_cameo or ''
_count_all = frame.args.count_all or ''
gallery = frame:expandTemplate{ title = 'Gallery Section (Cargo)', args = {
character = _character
,source = _source
,section = _section
,limit = _limit
,title = _title
,header = _header
} }
return gallery
end
-- concat all the strings in table s together with the given delimiter
function concatvalues(s,delimiter)
local t = { }
for k,v in ipairs(s) do
t[#t+1] = tostring(v)
end
return table.concat(t,delimiter)
end
function html_escape(s)
return (string.gsub(s, "[<>\"'/ ,]", {
["<"] = "%3C",
[">"] = "%3E",
['"'] = "%22",
["'"] = "%27",
["/"] = "%2F",
[" "] = "+",
[","] = "%2C"
}))
end
-- helpful for printing tables
function dump(o)
if type(o) == 'table' then
local s = '{ '
for k,v in pairs(o) do
if type(k) ~= 'number' then k = '"'..k..'"' end
s = s .. '['..k..'] = ' .. dump(v) .. ','
end
return s .. '} '
else
return tostring(o)
end
end
return p