Module:Employee

From TwogPedia
Revision as of 22:34, 6 May 2023 by Couchor (talk | contribs)

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

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

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

	local employees = ''
	
	local newEmployee = {
		id=args.id,
		position=args.position,
		joindate=args.joindate,
		leavedate=args.leavedate,
		inactivedate=args.inactivedate,
		newcompany=args.newcompany
	}
	
	if VariablesLua.varexists('Employees') then
		employees = VariablesLua.var('Employees')
		employees = employees .. '&&&' .. mw.text.jsonEncode(newEmployee)
	else
		employees = mw.text.jsonEncode(newEmployee)
	end
	
	VariablesLua.vardefine( 'Employees', employees )

	return 'yes'
end

return Employee