「モジュール:SMWメンバー情報」の版間の差分
編集の要約なし |
5行目、書き方を訂正 |
||
| (同じ利用者による、間の11版が非表示) | |||
| 3行目: | 3行目: | ||
local function setProperty(dataStore) | local function setProperty(dataStore) | ||
-- メイン空間のみ | -- メイン空間のみ | ||
if | if mw.title.getCurrentTitle().namespace ~= 0 then | ||
return true; | return true; | ||
end | end | ||
| 70行目: | 70行目: | ||
-- If the group is not extracted, use the provided group | -- If the group is not extracted, use the provided group | ||
if not extractedGroup or extractedGroup == "" then | if not extractedGroup or extractedGroup == "" then | ||
extractedGroup = args[" | extractedGroup = args["元グループ"] or args["グループ"] or "" | ||
end | end | ||
-- If the num is nil, return an error | -- If the num is nil, return an error | ||
| 77行目: | 77行目: | ||
end | end | ||
-- Store the group and selection times | -- Store the group and selection times | ||
total_s = total_s + tonumber(num) | if tonumber(num) > 0 then | ||
total_s = total_s + tonumber(num) | |||
table.insert(dataStore["選抜回数"], extractedGroup .. ';' .. num) | |||
end | |||
end | end | ||
-- Add the total selection times to the dataStore | -- Add the total selection times to the dataStore | ||
| 95行目: | 97行目: | ||
-- If the group is not extracted, use the provided group | -- If the group is not extracted, use the provided group | ||
if not extractedGroup or extractedGroup == "" then | if not extractedGroup or extractedGroup == "" then | ||
extractedGroup = args[" | extractedGroup = args["元グループ"] or args["グループ"] or "" | ||
end | end | ||
-- If the num is nil, return an error | -- If the num is nil, return an error | ||
| 102行目: | 104行目: | ||
end | end | ||
-- Store the group and selection times | -- Store the group and selection times | ||
total_c = total_c + tonumber(num) | if tonumber(num) > 0 then | ||
total_c = total_c + tonumber(num) | |||
table.insert(dataStore["センター回数"], extractedGroup .. ';' .. num) | |||
end | |||
end | end | ||
-- Add the total selection times to the dataStore | -- Add the total selection times to the dataStore | ||
dataStore["センター回数合計"] = total_c | |||
local generation = '' | local generation = '' | ||
| 121行目: | 123行目: | ||
dataStore["選抜回数"] = {} | dataStore["選抜回数"] = {} | ||
local lines_s = mw.text.split(args["選抜回数"] or "", '<br>') | local lines_s = mw.text.split(args["選抜回数"] or "0回", '<br>') | ||
mw.logObject(lines_s) | mw.logObject(lines_s) | ||
local total_s = 0 | local total_s = 0 | ||
| 129行目: | 131行目: | ||
-- If the group is not extracted, use the provided group | -- If the group is not extracted, use the provided group | ||
if not extractedGroup or extractedGroup == "" then | if not extractedGroup or extractedGroup == "" then | ||
extractedGroup = args[" | extractedGroup = args["元グループ"] or args["グループ"] or "" | ||
num = mw.ustring.match(line, "(%d+)回") | num = mw.ustring.match(line, "(%d+)回") | ||
end | end | ||
| 137行目: | 139行目: | ||
end | end | ||
-- Store the group and selection times | -- Store the group and selection times | ||
total_s = total_s + tonumber(num) | if tonumber(num) > 0 then | ||
total_s = total_s + tonumber(num) | |||
table.insert(dataStore["選抜回数"], extractedGroup .. ';' .. num) | |||
end | |||
end | end | ||
-- Add the total selection times to the dataStore | -- Add the total selection times to the dataStore | ||
| 147行目: | 151行目: | ||
dataStore["センター回数"] = {} | dataStore["センター回数"] = {} | ||
local lines_c = mw.text.split(args["センター回数"] or "", '<br>') | local lines_c = mw.text.split(args["センター回数"] or "0回", '<br>') | ||
mw.logObject(lines_c) | mw.logObject(lines_c) | ||
local total_c = 0 | local total_c = 0 | ||
| 155行目: | 159行目: | ||
-- If the group is not extracted, use the provided group | -- If the group is not extracted, use the provided group | ||
if not extractedGroup or extractedGroup == "" then | if not extractedGroup or extractedGroup == "" then | ||
extractedGroup = args[" | extractedGroup = args["元グループ"] or args["グループ"] or "" | ||
num = mw.ustring.match(line, "(%d+)回") | num = mw.ustring.match(line, "(%d+)回") | ||
end | end | ||
| 163行目: | 167行目: | ||
end | end | ||
-- Store the group and selection times | -- Store the group and selection times | ||
total_c = total_c + tonumber(num) | if tonumber(num) > 0 then | ||
total_c = total_c + tonumber(num) | |||
table.insert(dataStore["センター回数"], extractedGroup .. ';' .. num) | |||
end | |||
end | end | ||
-- Add the total selection times to the dataStore | -- Add the total selection times to the dataStore | ||
dataStore["センター回数合計"] = total_c | |||
setProperty(dataStore); | setProperty(dataStore); | ||