Skip to content

Function: $fromObject()

Call Signature

ts
function $fromObject<K, T>(object: Record<K, T>): LuaTable<K, T>;

Treat a TypeScript object as a Lua table.

The plugin removes this call and emits its argument. At runtime it builds a LuaTable via the environment's LuaTable runtime; numeric-string keys become numeric keys to match Lua semantics.

Type Parameters

Type Parameter
K extends string | number
T

Parameters

ParameterTypeDescription
objectRecord<K, T>TypeScript object.

Returns

LuaTable<K, T>

Same entries as a Lua table.

Call Signature

ts
function $fromObject<D>(object: D): LuaTable<keyof D, D[keyof D]>;

Treat a TypeScript object as a Lua table.

The plugin removes this call and emits its argument. At runtime it builds a LuaTable via the environment's LuaTable runtime; numeric-string keys become numeric keys to match Lua semantics.

Type Parameters

Type Parameter
D

Parameters

ParameterTypeDescription
objectDTypeScript object.

Returns

LuaTable<keyof D, D[keyof D]>

Same entries as a Lua table.