{
  "schema_version": 2,
  "id": "commands/eval_ro",
  "title": "EVAL_RO",
  "url": "https://redis.io/docs/latest/commands/eval_ro/",
  "summary": "Executes a read-only server-side Lua script.",
  "since": "7.0.0",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-09-18T09:48:32+01:00",
  "page_type": "content",
  "content_hash": "83aff917ea51b43b974803d3ca566c0543af79be12f00d7dde4f903c94708c2f",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "Runs a read-only Lua script. Unlike EVAL, this command can’t run commands that modify data.\n\nFor more information about when to use this command versus [`EVAL`](https://redis.io/docs/latest/commands/eval), please refer to [Read-only scripts](https://redis.io/docs/latest/develop/programmability#read-only-scripts).\n\nFor more information about [`EVAL`](https://redis.io/docs/latest/commands/eval) scripts please refer to [Introduction to Eval Scripts](https://redis.io/docs/latest/develop/programmability/eval-intro)."
    },
    {
      "id": "required-arguments",
      "title": "Required arguments",
      "role": "content",
      "text": "<details open><summary><code>script</code></summary>\n\nThe Lua script to evaluate. It must not modify data.\n\n</details>\n\n<details open><summary><code>numkeys</code></summary>\n\nThe number of key names that follow. Arguments after the keys are passed as regular arguments.\n\n</details>"
    },
    {
      "id": "optional-arguments",
      "title": "Optional arguments",
      "role": "parameters",
      "text": "<details open><summary><code>key [key ...]</code></summary>\n\nThe key names the script accesses, provided to it via the Lua `KEYS` global variable. There must be exactly `numkeys` of them.\n\n</details>\n\n<details open><summary><code>arg [arg ...]</code></summary>\n\nAdditional arguments provided to the script via the Lua `ARGV` variable.\n\n</details>"
    },
    {
      "id": "examples",
      "title": "Examples",
      "role": "example",
      "text": "[code example]"
    },
    {
      "id": "redis-software-and-redis-cloud-compatibility",
      "title": "Redis Software and Redis Cloud compatibility",
      "role": "content",
      "text": "| Redis<br />Software | Redis<br />Cloud | <span style=\"min-width: 9em; display: table-cell\">Notes</span> |\n|:----------------------|:-----------------|:------|\n| <span title=\"Supported\">&#x2705; Standard</span><br /><span title=\"Supported\"><nobr>&#x2705; Active-Active</nobr></span> | <span title=\"Supported\">&#x2705; Standard</span><br /><span title=\"Supported\"><nobr>&#x2705; Active-Active</nobr></span> |  |"
    },
    {
      "id": "return-information",
      "title": "Return information",
      "role": "returns",
      "text": "**RESP2:**\n\nThe return value depends on the script that was executed.\n\n**RESP3:**\n\nThe return value depends on the script that was executed."
    }
  ],
  "examples": [
    {
      "id": "examples-ex0",
      "language": "plaintext",
      "code": "> SET mykey \"Hello\"\nOK\n> EVAL_RO \"return redis.call('GET', KEYS[1])\" 1 mykey\n\"Hello\"\n> EVAL_RO \"return redis.call('DEL', KEYS[1])\" 1 mykey\n(error) ERR Error running script (call to b0d697da25b13e49157b2c214a4033546aba2104): @user_script:1: @user_script: 1: Write commands are not allowed from read-only scripts.",
      "section_id": "examples"
    }
  ]
}
