> For the complete documentation index, see [llms.txt](https://wiki.redmodding.org/scripting-cyberpunk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.redmodding.org/scripting-cyberpunk/redscript/language-reference/structure-names.md).

# Structure Names

Any custom structure you define in scripts (such as a class or an enum) naturally has their respective name, but also has a respective fully qualified name which includes its full [module](/scripting-cyberpunk/redscript/language-reference/modules.md) path (if it was defined in one).

## Simple Example

As an example, let's say we have defined a class as:

```swift
public class MySystem extends ScriptableSystem {
  // ...
}
```

The full qualified name for this structure would be `n"MySystem"`.

## Modules

When defining your structures in [modules](/scripting-cyberpunk/redscript/language-reference/modules.md), the full module path is also included in the structure's qualified name. For example, if we defined  the class above in the module `MyMod.Core`, it's qualified name would be `n"MyMod.Core.MySystem"`.

```swift
module MyMod.Core

public class MySystem extends ScriptableSystem {
  //
}
```

## `NameOf<T>()`

Redscript has a built-in function which can be used to get the qualified name for a structure:

```swift
func NameOf<T>() -> CName;
```

Instead of manually specifying the qualified name (which may change throughout the process of creating and updating your mod, which would then need for all references to be updated), this function will resolve into the qualified name for the given structure.

As an example:

```swift
module MyMod.Core

public class MySystem extends ScriptableSystem {
  // ...
}
```

```swift
let systemName: CName = NameOf<MySystem>(); // => n"MyMod.Core.MySystem"

//
```

## Usage

The fully qualified names for structures is needed as some systems require it to fulfill its purpose.

Such as [registering an event listener](/scripting-cyberpunk/scripting/game-systems/events-and-callbacks/custom-system-events.md#handling-the-event-1), getting an instance of your [scriptable](/scripting-cyberpunk/redscript/language-reference/scriptables.md) with [`gameScriptableSystemsContainer#Get`](https://nativedb.red4ext.com/gameScriptableSystemsContainer#Get) for [`ScriptableSystem`](/scripting-cyberpunk/redscript/language-reference/scriptables/scriptablesystem.md) or `ScriptableServiceContainer#GetService` for [`ScriptableService`](/scripting-cyberpunk/redscript/language-reference/scriptables/scriptableservice.md). These (and other methods and systems) require the full qualified name of your structure to work.

```swift
module MyMod.Core

public class MySystem extends ScriptableSystem {
  public static final func GetInstance(gameInstance: GameInstance) -> ref<MySystem> {
    return GameInstance.GetScriptableSystemsContainer(gameInstance).Get(n"MyMod.Core.MySystem") as MySystem;
  }
}
```

{% hint style="info" %}
Instead of manually specifying `n"MyMod.Core.MySystem"`, you can instead give `NameOf<MySystem>()` as the argument as the function will resolve into the qualified name for the system.
{% endhint %}
