UIDArray

UIDArray

A special array where push tries to reuse old unused indices. Why? This is for storing UIDs. You can see this as a sort of memory optimization: Each time an object is removed, it is replaced with null in the array. Then a new object can reuse that emplacement when pushing, instead of adding an element to the array. Technically the push function is not really pushing anymore, but the name is kept to make it easier for new devs to use (almost same API as classic array).

Constructor

new UIDArray()

Source:

Methods

get(uid)

Get an element from the UIDs array by UID.

Parameters:
Name Type Description
uid

The UID of the object to get.

Source:

push(item)

Adds an object to the UIDs array and returns it's UID.

Parameters:
Name Type Description
item

The item to assign a UID to.

Returns:
Type Description
  • The new UID of the object.
Source:

remove(uid)

Removes an element from the UIDs array by UID.

Parameters:
Name Type Description
uid

The UID of the object to remove.

Source: