# CyberM.resource — client runtime

Runs inside the game process. Reads and presentation are local; anything that changes shared state has to go through the server.

6 functions.

## generation

```lua
CyberM.resource.generation([resource])
```

`SHARED` — Available without a live game instance.

Generation number, incremented on every reload.

With no argument, returns the current resource generation. Pass a resource name to inspect that resource, or receive nil when it is missing.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `resource` | `string` | optional | — |

Returns: `integer, or nil`

Registered in `ResourceHost.cpp` (line 6518) as `LuaResourceGeneration`.

## hasPermission

```lua
CyberM.resource.hasPermission(permission)
```

`SHARED` — Available without a live game instance.

Whether the resource holds this permission.

Checks whether the current resource manifest grants an exact CyberM capability. It is a read-only convenience check; native APIs still enforce their own permission and must handle refusal results.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `permission` | `string` | required | — |

Returns: `boolean`

Registered in `ResourceHost.cpp` (line 6522) as `LuaHasPermission`.

## name

```lua
CyberM.resource.name()
```

`SHARED` — Available without a live game instance.

Name of the current resource.

Returns the current resource's immutable manifest name. This is equivalent to `GetCurrentResourceName()` and remains stable for the lifetime of the resource definition.

Returns: `string`

Registered in `ResourceHost.cpp` (line 6517) as `LuaResourceName`.

## readFile

```lua
CyberM.resource.readFile(path)
```

`SHARED` — Available without a live game instance.

Reads a file from the resource, within its declared allowlist.

Reads a file declared by the current resource manifest through a safe relative path. Undeclared files, traversal, oversized content and host filesystem paths are rejected.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `path` | `string` | required | — |

Returns: `contents, or nil`, `reason`

Registered in `ResourceHost.cpp` (line 6521) as `LuaReadFile`.

## state

```lua
CyberM.resource.state([resource])
```

`SHARED` — Available without a live game instance.

State of a resource.

Returns the lifecycle state known for a resource name, or for the current resource when omitted. It is an immediate snapshot and does not wait for dependencies or mutate lifecycle state.

| Parameter | Type | Required | Default |
|---|---|---|---|
| `resource` | `string` | optional | — |

Returns: `string`

Registered in `ResourceHost.cpp` (line 6520) as `LuaGetResourceState`.

## version

```lua
CyberM.resource.version()
```

`SHARED` — Available without a live game instance.

Version declared in `cyberm.lua`.

Returns the version string declared by the current resource manifest. It is package metadata and is unrelated to the CyberM runtime or Lua interpreter version.

Returns: `string`

Registered in `ResourceHost.cpp` (line 6519) as `LuaResourceVersion`.

