Module:Sandbox/DD4235/Military Decorations explained

militaryDecorations = militaryDecorations.hello = function return "Hello, world from a LUA script"end

militaryDecorations.makeTemplate = function(frame) strOut = frame.args.pre and "

" or ""
	strOut = strOut .. "{|class='wikitable'\n"
	row = 1
	col = 1
	
	while frame.args[row.."-"..col.."-name"] or frame.args[row.."-"..col.."-ribbon"] do
		if row ~= 1 then strOut = strOut.."|-\n" end
		while frame.args[row.."-"..col.."-name"] or frame.args[row.."-"..col.."-ribbon"] do
			strOut = strOut..
						"|{{Ribbon devices"..
						"|name="        ..(frame.args[row.."-"..col.."-name"]         and frame.args[row.."-"..col.."-name"]         or "")..
						"|ribbon="      ..(frame.args[row.."-"..col.."-ribbon"]       and frame.args[row.."-"..col.."-ribbon"]       or "")..
						"|number="      ..(frame.args[row.."-"..col.."-number"]       and frame.args[row.."-"..col.."-number"]       or "")..
						"|type="        ..(frame.args[row.."-"..col.."-type"]         and frame.args[row.."-"..col.."-type"]         or "")..
						"|other_device="..(frame.args[row.."-"..col.."-other_device"] and frame.args[row.."-"..col.."-other_device"] or "")..
						"|alt="         ..(frame.args[row.."-"..col.."-desc"]         and frame.args[row.."-"..col.."-desc"]         or "")..
						"}}\n"
			col = col + 1
		end
		col = 1
		row = row + 1
	end
	
	strOut = strOut.."|}\n"
	
	return strOut..(frame.args.pre and "
" or "")end

return militaryDecorations