(Created page with "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') employe...") |
mNo edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 10: | Line 10: | ||
local newEmployee = { | local newEmployee = { | ||
id=args.id, | id=args.id, | ||
name=args.name, | |||
flag=args.flag, | |||
position=args.position, | position=args.position, | ||
joindate=args.joindate, | joindate=args.joindate, | ||
Line 17: | Line 19: | ||
} | } | ||
if VariablesLua.varexists('Employees') then | if VariablesLua.varexists('Employees') and VariablesLua.var('Employees') ~= '' then | ||
employees = VariablesLua.var('Employees') | employees = VariablesLua.var('Employees') | ||
employees = employees .. ' | employees = employees .. '&&&' .. mw.text.jsonEncode(newEmployee) | ||
else | else | ||
employees = mw.text.jsonEncode(newEmployee) | employees = mw.text.jsonEncode(newEmployee) |
Latest revision as of 08:35, 25 April 2024
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,
name=args.name,
flag=args.flag,
position=args.position,
joindate=args.joindate,
leavedate=args.leavedate,
inactivedate=args.inactivedate,
newcompany=args.newcompany
}
if VariablesLua.varexists('Employees') and VariablesLua.var('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