Module:ID Table Builder

local p = {}

local header = " "

local max_id_error = "\'\'\'ERROR: \"max_id\" must be set.\'\'\'"

local out = ""

function p.Build(frame) local data = frame:getParent.args; local start_id = pfetch(data, "start_id") if not start_id then start_id = 1 end --Check for max ID	local max_id = pfetch(data, "max_id") if not max_id then return max_id_error end --BUILD TABLE--- --Header out = out .. header for id = start_id, max_id do		local s_id = tostring(id) out = out .. row[1] .. s_id .. row[2] .. id_cell[1] .. s_id .. id_cell[2] .. s_id .. id_cell[3] .. row[3] end out = out .. footer return out end

--Basic_Functions_______________________________________________________________

--Protected fetch function-reads in data and returns errors as false function pfetch(data, target) local temp --temporary variable if (select(1,pcall(function temp = data[target] end))) then --attempt fetch, use pcall to catch any errors, and return the requested data on success. return temp else --if read attempt failed, return nil. return nil end end

return p