Module:Solar eclipse: Difference between revisions

Content deleted Content added
Per request on my talk page
temporary code until the remaining db pages are migrated
Line 2:
local args = {}
 
local data_module_prefix = "Module:Solar eclipse/dbdata/"
local data_module_prefix2 = "Module:Solar eclipse/db/"
 
local function ifnotempty(s,a,b)
Line 10 ⟶ 11:
return b
end
end
 
local function ifexist(page)
if not page then return false end
if mw.title.new(page).exists then return true end
return false
end
 
Line 37 ⟶ 44:
if( yearstr ~= '' ) then
local dbsubpage = math.floor( (tonumber(yearstr) - 1) / 50 ) * 5
local dbpage = ifexist(data_module_prefix .. tostring( dbsubpage )) and data_module_prefix .. tostring( dbsubpage ) or data_module_prefix2 .. tostring( dbsubpage )
if (mw.title.new(dbpage)) then
local data = mw.loadData(dbpage)