User:Bongolium500/Lua tests: Difference between revisions

From Tardis Wiki, the free Doctor Who reference
No edit summary
No edit summary
Line 4: Line 4:


{{#invoke:Bongolium500/story cite|getinfo}}
{{#invoke:Bongolium500/story cite|getinfo}}
{{#var:sc-Dalek  (TV story)}}


<pre>[[Rose (TV story)]]</pre>
<pre>[[Rose (TV story)]]</pre>

Revision as of 11:32, 27 November 2021

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".

[[Rose (TV story)]]
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