模块:Test:修订间差异

跳到导航 跳到搜索
添加72字节 、​ 2022年1月31日 (星期一)
无编辑摘要
无编辑摘要
无编辑摘要
第146行: 第146行:
     -- extract row_ids in each tables
     -- extract row_ids in each tables
     -- i hate lua why array subscribtion starts at 1
     -- i hate lua why array subscribtion starts at 1
     local tabs_row_ids = {}
     local tot_row_ids = {}
     local item_per_tab = tonumber(params["item_per_tab"])
     local item_per_tab = tonumber(params["item_per_tab"])
     for k, _ in pairs(args) do
     for k, _ in pairs(args) do
         local anum = ('' .. k):match('^a(%d+)$')
         local anum = ('' .. k):match('^a(%d+)$')
         if anum then  
         if anum then  
             if tabs_row_ids[anum / item_per_tab + 1] == nil then
             table.insert(tot_row_ids, tonumber(anum))
                tabs_row_ids[anum / item_per_tab + 1] = {}
        end
            end
    end
            table.insert(tabs_row_ids[anum / item_per_tab + 1], tonumber(anum))
    table.sort(tot_row_ids)
 
    local tabs_row_ids = {}
    for i, id in ipairs(tot_row_ids) do
        if i % item_per_tab == 0 then
            tabs_row_ids[i / item_per_tab + 1] = {}
         end
         end
        table.insert(tabs_row_ids[i / item_per_tab + 1], id)
     end
     end
    table.sort(tabs_row_ids)


     -- if only one table is needed...
     -- if only one table is needed...

导航菜单