Module:SMW: Difference between revisions
From devsummit
No edit summary |
No edit summary |
||
Line 3: | Line 3: | ||
-- Return results | -- Return results | ||
function p. | function p.sessionTable(frame) | ||
local queryResult = mw.smw.getQueryResult( "[[Category:Sessions]]" ) | |||
local queryResult = mw.smw.getQueryResult( | |||
if queryResult == nil then | if queryResult == nil then | ||
Line 19: | Line 11: | ||
end | end | ||
if type( queryResult ) | if type( queryResult ) ~= "table" then | ||
local myResult = "" | return "(invalid query result)" | ||
end | |||
local myResult = "" | |||
for k,v in pairs( queryResult.results ) do | |||
myResult = myResult .. "[[" .. v.fulltext .. "]]" .. "<br/>" | |||
end | end | ||
return | return myResult | ||
end | end | ||
return p | return p |
Revision as of 08:44, 27 November 2017
Documentation for this module may be created at Module:SMW/doc
-- Module:SMW
local p = {}
-- Return results
function p.sessionTable(frame)
local queryResult = mw.smw.getQueryResult( "[[Category:Sessions]]" )
if queryResult == nil then
return "(no values)"
end
if type( queryResult ) ~= "table" then
return "(invalid query result)"
end
local myResult = ""
for k,v in pairs( queryResult.results ) do
myResult = myResult .. "[[" .. v.fulltext .. "]]" .. "<br/>"
end
return myResult
end
return p