Files
metabuilder/packages/data_table/seed/scripts/selection/get_selected_indices.lua

22 lines
497 B
Lua

-- Get array of selected indices
-- Single function module for data table selection
---@class GetSelectedIndices
local M = {}
---Get array of selected indices
---@param state SelectionState Current selection state
---@return integer[] Array of selected row indices
function M.getSelectedIndices(state)
local indices = {}
for k, v in pairs(state.selected) do
if v then
table.insert(indices, k)
end
end
table.sort(indices)
return indices
end
return M