486
回編集
細 (名前変更に追従) |
細 (要素の最後を取得するように修正) |
||
4行目: | 4行目: | ||
maintenancedata = mw.loadJsonData("module:Maintenance/data.json") | maintenancedata = mw.loadJsonData("module:Maintenance/data.json") | ||
--forで最後の要素までカウントする | |||
for index,item in ipairs(maintenancedata.maintenance) do | |||
c = index | |||
end | |||
-- 開始時間について定義 | -- 開始時間について定義 | ||
if maintenancedata.maintenance[ | if maintenancedata.maintenance[c].start == "near" then | ||
start = "-1" | start = "-1" | ||
else | else | ||
start = os.date("!%Y-%m-%d %T",maintenancedata.maintenance[ | start = os.date("!%Y-%m-%d %T",maintenancedata.maintenance[c].start) | ||
end | end | ||
-- 終了時間について定義 | -- 終了時間について定義 | ||
if maintenancedata.maintenance[ | if maintenancedata.maintenance[c].time == "few" then | ||
endtime = "0" | endtime = "0" | ||
elseif maintenancedata.maintenance[ | elseif maintenancedata.maintenance[c].time == "intermittent" then | ||
endtime = "0" | endtime = "0" | ||
elseif maintenancedata.maintenance[ | elseif maintenancedata.maintenance[c].time == "observation" then | ||
endtime = "0" | endtime = "0" | ||
else | else | ||
endtime = maintenancedata.maintenance[ | endtime = maintenancedata.maintenance[c].time | ||
end | end | ||