Skip to content

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 ParameterDescription
TExpected type of the registered value.

Parameters ​

ParameterTypeDescription
keystringGlobal 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 ​

ParameterTypeDescription
keystringDot-separated global path to register.
valueunknownValue 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.