User:Bongolium500/Lua tests
From Tardis Wiki, the free Doctor Who reference
All modules invoked here will be subpages of Module:Bongolium500.
Script error: The function "hello" does not exist.
Script error: No such module "Bongolium500/story cite".
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