Module:Sandbox

local p = {} local getArgs = require('Module:Arguments').getArgs

function setDefault (t, d)	local mt = {__index = function return d end} setmetatable(t, mt) end

-- Imported function from https://www.lua.org/pil/13.4.3.html -- function copyTable(t) local t2 = {} for k,v in pairs(t) do   	t2[k] = v	end return t2 end

function p.outputAvailability (data, args1, args2, args3, args4, note, text, size, nb, noimages) local function isEmpty(s) return s == nil or s == '' end

local game = copyTable(data.game) local print = ' ' if not isEmpty(args1) then -- Availability with a specific villager -- if (args1 == "Villager") then setDefault(game," NH Villager Icon.png") if isEmpty(noimages) then if (args2 == "Lulu (anteater)") then print = print .. ''			   	end end else -- Main availability function -- if not isEmpty(data.availability[args1]) and not isEmpty(data.availability[args1][1]) and isEmpty(noimages) then print = print .. ' '				end if not isEmpty(data.availability[args1]) and not isEmpty(data.availability[args1][3]) then print = print ..  .. data.availability[args1][3]			   	if (data.availability[args1][3] == data.availability[args1][4]) then			    		print = print ..  else if not isEmpty(text) then print = print .. '|' .. text .. ']]'				   	else print = print .. '|' .. data.availability[args1][4] .. ']]'			   		end end else if not isEmpty(data.availability[args1]) and not isEmpty(data.availability[args1][5]) then if not isEmpty(text) then print = print .. text else print = print .. data.availability[args1][5] end else if not isEmpty(text) then print = print .. text else print = print .. args1 end end end end end -- Note function -- if not isEmpty(note) then print = print .. ' (' .. note .. ') ' end print = print .. ' '		-- Line break function -- if not isEmpty(nb) then print = print .. ''		else print = print .. ' '		end end return print end return p