Module:Compositor 2

local p = { }

local function round(n, decimals) local pow = 10^(decimals or 0) return math.ceil(n * pow + 0.5) / pow end

function p.composite(frame) local argument_numbers = 0 for _ in ipairs(frame.args) do		argument_numbers = argument_numbers + 1 end local original_image = frame.args[1] local original_size_x = tonumber(frame.args[2]) local original_size_y = tonumber(frame.args[3]) local new_size_x = tonumber(frame.args[4]) local new_size_y = tonumber(frame.args[5]) local temp = "\n" local elements = { } local elem_number = math.ceil((argument_numbers - 5) / 5) for i=1,elem_number do		elements[i] = { } elements[i].elem = frame.args[6+((i-1)*5)] elements[i].x = (tonumber(frame.args[7+((i-1)*5)]) - (tonumber(frame.args[9+((i-1)*5)]) / 2) ) / (original_size_x / 100.0) elements[i].y = (tonumber(frame.args[8+((i-1)*5)]) - (tonumber(frame.args[10+((i-1)*5)]) / 2)) / (original_size_y / 100.0) end for key,value in ipairs(elements) do temp = temp .."" .. value.elem .. " \n" end temp = temp .. " "	return temp end return p