Module:Sandbox/Lemondoge/templatedata

require('strict'); local getArgs = require ('Module:Arguments').getArgs; local p = {} local function function_that_does_stuff (label, param, description, ptype, status) local result result = '"'..param..'": { "label": '..label..'", "description": "'..description..'", "type": "'..ptype..'", "required": '..status..' },'	return result.."poof" end

function p.templatedata (frame) local args=getArgs (frame) local final_result local i=1

while frame.args['label'..i] do		local result = function_that_does_stuff (args['label'..i], args['param'..i], args['description'..i], args['type'..i], args['status'..i]) final_result = final_result..result i = i + 1; end return final_result end

return p

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

function p.main(frame) local args = getArgs(frame) return p._main(args) end

p._main = function(frame) local i = 1 local num = tonumber(frame.args["num"]) local result = {} while (i <= num) do local variable = frame.args["variable" .. tostring(i)] local description = frame.args["description" .. tostring(i)] local label = frame.args["label" .. tostring(i)] local type = frame.args["type" .. tostring(i)] local required = frame.args["required" .. tostring(i)] if i == num then result[i] = '"' .. variable .. '": {"description": "' .. description .. '", "label": "' .. label .. '", "type": "' .. type .. '", "required": ' .. required .. ' }'		else result[i] = '"' .. variable .. '": {"description": "' .. description .. '", "label": "' .. label .. '", "type": "' .. type .. '", "required": ' .. required .. ' }, '		end i = i + 1 end return unpack(result) end --'{ "description": "' .. frame.args["description"] .. '", "params": {' .. unpack(result) .. "}"

return p]]--