---
title: table.lookup_integer
summary: null
url: >-
  https://www.fastly.com/documentation/reference/vcl/functions/table/table-lookup-integer
---

```
INTEGER table.lookup_integer(ID id, STRING key, INTEGER default)
```

**Available in:** all subroutines

Looks up the key `key` in the table `id`. When the key is present, its
associated value will be returned. When the key is absent, the `default`
value is returned. The `default` value is required.

## Example

```vcl
backend prod { .host = "203.0.113.0"; }
backend beta { .host = "203.0.113.1"; }

table percent_for_beta INTEGER {
  "a.example.com": 50,
  "b.example.com": 20,
  "c.example.com": 80,
}

sub vcl_recv {
  if (randomint(0, 99) < table.lookup_integer(percent_for_beta, req.http.host, 0)) {
    set req.backend = beta;
  } else {
    set req.backend = prod;
  }
}
```
