User:Bongolium500/Lua tests: Difference between revisions

From Tardis Wiki, the free Doctor Who reference
no edit summary
(Created page with "All modules invoked here will be subpages of Module:Bongolium500. {{#invoke:Bongolium500/learning|hello}} {{#invoke:Bongolium500/story cite|getinfo}}")
 
No edit summary
Line 4: Line 4:


{{#invoke:Bongolium500/story cite|getinfo}}
{{#invoke:Bongolium500/story cite|getinfo}}
<pre>
for n = 1, #queryResult do
    local current = queryResult[n]
    local output = ""
    local data = {["partOf"] = "", ["series"] = "", ["seriesNumber"] = "", ["season"] = "", ["Writer"] = "", ["publisher"] = ""}
    for i=1, #properties do
    if current["Writer"] ~= nil and type(current["Writer"]) ~= "table" then --]]
    data[properties[i]] = data[properties[i]] .. current["Writer"]
    elseif type(current["Writer"]) == "table" then
    for i = 1, #current["Writer"] do
    data[properties[i]] = data[properties[i]] .. current["Writer"][i]
    if i == #current["Writer"]-1 then
    data[properties[i]] = data[properties[i]] .. " and "
    elseif i == #current["Writer"] then
    data[properties[i]] = data[properties[i]]
    else
    data[properties[i]] = data[properties[i]] .. ", "
    end
    end
    end
    end
    output = output .. data["Writer"]
    util_vars.vardefine(current[1], output)
    end
    testtext = util_vars.var("Rose (TV story)")
    return testtext
end
end</pre>
Cookies help us deliver our services. By using our services, you agree to our use of cookies.