Skip to content

Function: $fromArray()

ts
function $fromArray<T>(array: T[]): LuaTable<number, T>;

Treat a TypeScript array as a Lua array.

The plugin removes this call and emits its argument (arrays are Lua tables in the game). At runtime it builds a LuaTable with 1-based keys via the environment's LuaTable runtime, so consumers can use the result through the LuaTable API under jest/node.

Type Parameters

Type Parameter
T

Parameters

ParameterTypeDescription
arrayT[]TypeScript array.

Returns

LuaTable<number, T>

Same values as a Lua array.