Client

Exports for handling data table UIs.

open

Opens a new data table interface with headers, data, and action buttons.

exports.rw_datatables:open(data)
  • data: table

    • id: string Unique identifier for this table instance.

    • head: string[] List of column names for the table header.

    • list: string[][] A 2D table of rows, where each row is a table of strings that correspond to each column defined in head. Example:

      {
          { "123", "John Doe", "Leader", "true" },
          { "456", "Jane Doe", "Member", "false" }
      }
    • onClose?: function() A callback executed when the table is closed.

    • actions?: table<string, function(index: number, data: table)> Defines action buttons that can be clicked for each row.

      • index: Row number clicked (1-based).
      • data: Table containing that row’s values.

Example

exports.rw_datatables:open({
    id = "Title",
    head = { "id", "Name", "Label", "Ceo" },
    list = {
        { "101", "Alpha Crew", "Security", "true" },
        { "102", "Beta Crew", "Transport", "false" }
    },
    onClose = function()
        print("Closed crew table")
    end,
    actions = {
        ["⬆️ Go To"] = function(index, data)
            local id = tonumber(input[1])
            ExecuteCommand(("tp %d"):format(id))
        end,
        ["πŸ—‘οΈ Remove Job"] = function(index, data)
             local id = tonumber(input[1])
            ExecuteCommand(("setjob %d unemployed"):format(id))
        end,
        ["❌ Kick"] = function(index, data)
            local id = tonumber(input[1])
            ExecuteCommand(("kick %d "):format(id))
        end
    }
})

Arguments Summary

  • id: string – Unique name for the table window.
  • head: string[] – Column headers.
  • list: string[][] – Rows of data matching header order.
  • onClose: function() – Triggered when closing the UI.
  • actions: table<string, function(index: number, data: table)> – Named actions.