---
name: "Namespace"
type: topic
source: https://community.bistudio.com/wiki/Namespace
revid: 369024
updated: 2024-08-26T13:59:25Z
---

# Namespace

Arma 2 v1.00

A [Namespace](../topics/Namespace.md) is a container for [Variables](../topics/Variables.md).
Any [global](../topics/Variables.md#scopes) variable is always part of exactly one namespace - another namespace may contain a variable with the same [Identifier](../topics/Identifier.md), but they remain two distinct independent variables.
Scripts and functions are always executed in the context of some namespace.

The default namespace is the [missionNamespace](../commands/missionNamespace.md).

### Namespaces

| Game | Namespace | Description | Lifetime |
|---|---|---|---|
| Arma 2 v1.00 | [missionNamespace](../commands/missionNamespace.md) | The global namespace of the mission. Every mission has its own [missionNamespace](../commands/missionNamespace.md). | Mission duration |
| Arma 2 v1.00 | [parsingNamespace](../commands/parsingNamespace.md) | The global namespace attached to the [Config Parser](../topics/PreProcessor_Commands.md). | Game session |
| Arma 2 v1.00 | [uiNamespace](../commands/uiNamespace.md) | The global namespace attached to the user interface. | Game session |
| Take On Helicopters v1.00 | [profileNamespace](../commands/profileNamespace.md) | The global namespace attached to the user profile. | Profile lifetime |
| Arma 3 v2.00 | [localNamespace](../commands/localNamespace.md) | This namespace is like the [missionNamespace](../commands/missionNamespace.md), except that its variables can not be sent over network (e.g. with [publicVariable](../commands/publicVariable.md)) or serialised. | Mission duration |
| Arma 3 v2.06 | [serverNamespace](../commands/serverNamespace.md) | The namespace used by Server Event Handlers. This namespace is only available on servers. | Game session |
| Arma 3 v2.10 | [missionProfileNamespace](../commands/missionProfileNamespace.md) | This namespace is like [profileNamespace](../commands/profileNamespace.md) but is also attached to a [missionName](../commands/missionName.md) or [missionGroup](../topics/Description.ext.md#missiongroup). Automatically loaded before [init.sqf](../topics/Event_Scripts.md#init-sqf). | Profile lifetime |

### Serialisation

Only the [missionNamespace](../commands/missionNamespace.md) is serialised, as in only the variables from this namespace are saved when the game is saved (e.g. with [saveGame](../commands/saveGame.md)) and loaded when the game is loaded (e.g. with [loadGame](../commands/loadGame.md)).
This is also the reason the game will complain that one should use [disableSerialization](../commands/disableSerialization.md) when storing UI variables in [missionNamespace](../commands/missionNamespace.md) - UI elements are temporary and therefore exempt from serialisation by default.

### Scripting

Interacting with namespaces is not difficult:
- The [getVariable](../commands/getVariable.md) and [setVariable](../commands/setVariable.md) commands can be used to work with variables from different namespaces.
- The [with](../commands/with.md)-[do](../commands/do.md) construct can be used to switch the context of an entire code block to another namespace.
- The [currentNamespace](../commands/currentNamespace.md) command can be used to obtain the namespace which the calling script is running in.

<sub>Source: [BI Community Wiki — Namespace](https://community.bistudio.com/wiki/Namespace) (revision 369024).</sub>
