View source for Module:LoadData
Jump to navigation
Jump to search
You do not have permission to edit this page, for the following reasons:
You can view and copy the source of this page.
local p = {}
-- Finds the next key key <= or >= the given i.
-- operator is ±1
local function findItemRange(data, i, operator)
local bestIndex = nil
i = i * operator
for k, v in pairs(data) do
local kop = type(k) == 'number' and k * operator
if kop and kop <= i and (bestIndex == nil or kop > bestIndex * operator) then
bestIndex = k
end
end
if bestIndex then return data[bestIndex] else return nil end
end
local function load(datamodule, frame)
local args = frame.args
local data = mw.loadData(datamodule)
for i = 1, 20 do
if args[i] then data = data[tonumber(args[i]) or args[i]]
elseif args[i .. ' lteq'] then
000
1:0
Template used on this page:
Return to Module:LoadData.