> Agent-readable docs index: /llms.txt. Download /docs.zip to grep all markdown files locally.

---
title: Script Environment
description: How Neverlose isolates each CS:GO script in its own Lua environment.
icon: box
sidebar_position: 2
---

# Script Environment

Each script runs in its **own separate environment**. Global variables are not shared between scripts — a global you set in one script is invisible to every other script.

```lua
-- In script A:
shared_value = 42        -- a global in A's environment

-- In script B:
print(shared_value)      -- nil — B has its own environment
```

This means two scripts can safely use the same global name without colliding, and one script can't accidentally read or clobber another's state.

<Warning>
  Because environments are isolated, you **can't pass state between scripts through globals**. If two scripts need to share data, go through the game itself, a [file](/csgo/api-reference/namespaces/files), or the [database](/csgo/api-reference/namespaces/db).
</Warning>

<Tip>
  Inside a single script, prefer `local` for everything anyway — it's faster (a register access instead of a global hash lookup) and avoids leaking names. See the [Lua Crash Course](/csgo/guides/lua-crash-course#variables-and-flow-control).
</Tip>
