Module:Member

From TwogPedia
Revision as of 11:13, 29 September 2023 by Couchor (talk | contribs) (Created page with "local getArgs = require('Module:Arguments').getArgs VariablesLua = mw.ext.VariablesLua local Member = {} function Member.main(frame) local args = getArgs(frame) local members = '' local newMember = { id=args.id, name=args.name, flag=args.flag, position=args.position, captain=args.captain, joindate=args.joindate, leavedate=args.leavedate, inactivedate=args.inactivedate, newteam=args.newteam } if VariablesLua.varexists('Members') and #Variables...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:Member/doc

local getArgs = require('Module:Arguments').getArgs
VariablesLua = mw.ext.VariablesLua
local Member = {}

function Member.main(frame)
	local args = getArgs(frame)

	local members = ''
	
	local newMember = {
		id=args.id,
		name=args.name,
		flag=args.flag,
		position=args.position,
		captain=args.captain,
		joindate=args.joindate,
		leavedate=args.leavedate,
		inactivedate=args.inactivedate,
		newteam=args.newteam
	}
	
	if VariablesLua.varexists('Members') and #VariablesLua.var('Members') > 0 then
		members = VariablesLua.var('Members')
		members = members .. '&&&' .. mw.text.jsonEncode(newMember)
	else
		members = mw.text.jsonEncode(newMember)
	end

	VariablesLua.vardefine( 'Members', members )

	return 'yes'
end

return Member