Line 33: |
Line 33: |
| | | |
| local function render(args, frame) | | local function render(args, frame) |
− | -- Filter term ([1] = pattern to match, [2] = data element to match)
| + | local category = args.explicit[1] |
− | local filter = (args.explicit['filter'] or nil) | + | local data = Data.load('Quest', category) |
− | local categories = (args.explicit['categories'] or { args.explicit[1] }) | |
| local result = {} | | local result = {} |
| table.insert(result, table_header) | | table.insert(result, table_header) |
− | for i,cat in ipairs(categories) do | + | for i, q in ipairs(data) do |
− | local data = Data.load('Quest', cat)
| + | -- table.insert(result, _.format(table_row, q)) |
− | if (type(filter) == nil) or (string.match(data[filter[2]], filter[1])) then
| + | table.insert(result, _.format(table_row, { |
− | for i, q in ipairs(data) do
| + | label = q.label, |
− | -- table.insert(result, _.format(table_row, q))
| + | title = q.title, |
− | table.insert(result, _.format(table_row, {
| + | title_en = q.title_en, |
− | label = q.label,
| + | detail_en = q.detail_en, |
− | title = q.title,
| + | reward_fuel = q.reward_fuel, |
− | title_en = q.title_en,
| + | reward_ammo = q.reward_ammo, |
− | detail_en = q.detail_en,
| + | reward_steel = q.reward_steel, |
− | reward_fuel = q.reward_fuel,
| + | reward_bauxite = q.reward_bauxite, |
− | reward_ammo = q.reward_ammo,
| + | reward_other = q.reward_other, |
− | reward_steel = q.reward_steel,
| + | note = q.note, |
− | reward_bauxite = q.reward_bauxite,
| + | letter = q.label:sub(1, 1) |
− | reward_other = q.reward_other,
| + | })) |
− | note = q.note,
| |
− | letter = q.label:sub(1, 1)
| |
− | }))
| |
− | end
| |
− | end
| |
| end | | end |
| table.insert(result, table_footer) | | table.insert(result, table_footer) |