# CFX::STATE_BAG_HAS_KEY

- **Hash:** `0x12A330`
- **Namespace:** CFX
- **Runtime name (Lua/JS):** `StateBagHasKey`
- **Side:** shared (Cfx runtime native)
- **Name status:** official
- **Documentation:** described
- **URL:** https://natives.borderlinerp.com/natives/CFX/STATE_BAG_HAS_KEY

## Signature

```c
bool STATE_BAG_HAS_KEY(char* bagName, char* key);
```

## Parameters

- `bagName` (`char*`) — The name of the bag.
- `key` (`char*`) — The key used to check data existence.

## Returns

`bool` — Returns true if the data associated with the specified key exists; otherwise, returns false.

## Usage

### Lua

```lua
local retval = StateBagHasKey(bagName, key)

-- always available, by hash
local retval = Citizen.InvokeNative(0x12a330, bagName, key, Citizen.ReturnResultAnyway())
```

### JavaScript

```js
const retval = StateBagHasKey(bagName, key);

// by hash
const retval = Citizen.invokeNative('0x12a330', bagName, key, Citizen.returnResultAnyway());
```

### C#

```csharp
bool retval = Function.Call<bool>((Hash)0x12a330, bagName, key);
```

*Sources: Cfx.re native reference.*
