Skip to Content
defold-typescript
Get startedGuidesAPILibraries
Global types

Vector

A numeric vector of any size, accessed by index for reads and writes; v.length() is its component count.

The index is 1-based and passed to Defold unchanged: v[1] is the first component, and an index outside 1..v.length() raises. v.length() compiles to the Lua length operator #v; reading v.length as a field raises, since the engine accepts only integer keys.

Functions

length(): number

Lua unary # operator.

Returns

  • number

On this page