-- Get a list of the keys from a table
function GroupLeader.GetTableKeys(aTable)
    local keys = {}
    local n = 0
    for k, v in pairs(aTable) do
      n = n + 1
      keys[n] = k
    end
    return keys
end

-- Add a message to the chat window
function GroupLeader.ChatMessage(message)
    CHAT_SYSTEM:AddMessage(message)
end

function GroupLeader.RGBPercToHex(r, g, b)
    r = r <= 1 and r >= 0 and r or 0
    g = g <= 1 and g >= 0 and g or 0
    b = b <= 1 and b >= 0 and b or 0
    return string.format("%02x%02x%02x", r*255, g*255, b*255)
end

function GroupLeader.SplitString(input)
    local result = {}
    local counter = 1
    for s in string.gmatch(input, "%S+") do
        result[counter] = s
        counter = counter + 1
    end
    return result
end