Class: MockExternals
Controls the Lua global scope used by extern and getExtern in runtime tests.
Constructors
Constructor
ts
new MockExternals(): MockExternals;Returns
MockExternals
Methods
get()
ts
static get<T>(key: string): T;Read an externed value from the current mocked Lua global scope.
Type Parameters
| Type Parameter | Description |
|---|---|
T | Expected type of the registered value. |
Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | Global key to read. |
Returns
T
The registered value.
register()
ts
static register(key: string, value: unknown): void;Register an externed value in the current mocked Lua global scope.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | Dot-separated global path to register. |
value | unknown | Value exposed through getExtern. |
Returns
void
reset()
ts
static reset(): AnyObject;Replace the mocked Lua global scope with an empty table.
Returns
AnyObject
The new global scope for additional direct setup when necessary.