Scripting API

Scripting API

FixedList32<T>

Struct in Abyss.Core, from Abyss.Core.

A list of up to 32 T a component holds in itself: plain data, as a component has to be, its room fixed when it is written and its items as many as it holds. The inspector shows it as a list with its size, and a scene writes the items it holds.

public struct FixedList32<T> where T : unmanaged

Remarks

Its room is its capacity in items, whatever T is: a FixedList32<Vector2> holds 32 points, and takes as many bytes as that and its count. FixedList8, FixedList16, FixedList32, FixedList64 and FixedList128 are the sizes there are.

Written as a list is: Points = [new(0, 0), new(1, 0)] where it is declared or set, Points.Add(p), Points[i], foreach over the items it holds. What it does not hold reads as zero, and an item taken out leaves zero behind it, so a scene never keeps what a list no longer holds.

Type parameters

  • T: What it holds: plain data.

Properties

Count

public readonly int Count { get; }

How many it holds.

IsEmpty

public readonly bool IsEmpty { get; }

Whether it holds none.

IsFull

public readonly bool IsFull { get; }

Whether it has no room for another.

Indexers

this[]

public ref T this[int index] { get; }

The item at index, which is one it holds.

Parameters

  • index

Exceptions

  • ArgumentOutOfRangeException: It holds no item there.

Methods

AsSpan

public Span<T> AsSpan()

The items it holds.

AsReadOnlySpan

public readonly ReadOnlySpan<T> AsReadOnlySpan()

The items it holds, to read.

GetEnumerator

public Span<T>.Enumerator GetEnumerator()

Goes through the items it holds, each by reference.

Add

public void Add(in T item)

Puts item after the last it holds.

Parameters

  • item

Exceptions

  • InvalidOperationException: It is full.

TryAdd

public bool TryAdd(in T item)

Puts item after the last it holds, where there is room.

Parameters

  • item

Returns Whether there was room.

Insert

public void Insert(int index, in T item)

Puts item at index, those after it moving up one.

Parameters

  • index
  • item

Exceptions

  • ArgumentOutOfRangeException: The index is past the items it holds.
  • InvalidOperationException: It is full.

RemoveAt

public void RemoveAt(int index)

Takes out the item at index, those after it moving down one, and zero left where the last was.

Parameters

  • index

Exceptions

  • ArgumentOutOfRangeException: It holds no item there.

Clear

public void Clear()

Takes out every item, zero left where they were.

Constants

Capacity

public const int Capacity = 32

How many it has room for.