Skip to content

DsWalkable

Hyomoto edited this page Dec 12, 2020 · 15 revisions
Jump To Go Back Arguments Methods Variables

DsWalkable( values... )

Implements: DsLinkedList

A garbage-collected, linear-traversable linked-list with state memory. DsWalkable is designed / for iterable data that is designed to be read in one direction, such as a list of points in a / path. Reading past the end will result in the list looping, thus it will reset itself once it has / been read through fully, otherwise start() must be called to reset.

walker = new DsWalkable( 1, 2, 3, 4, 5 );

while( walker.has_next() ) {
  show_debug_message( walker.next() );
}

Arguments

Name Type Purpose
values... undef none provided

Methods

Jump To top start has_next remaining next peek copy is

start( at )

Returns: N/A undefined

Name Type Purpose
at int optional: The index to start at. Default: 0

Starts the list at the given entry.


has_next()

Returns: boolean (true or false)

Name Type Purpose
None

Returns true if the list has not yet reached the end


remaining()

Returns: int (0..)

Name Type Purpose
None

Returns the number of links remaining in the list


next()

Returns: Mixed

Name Type Purpose
None

Returns the next value in the list


peek()

Returns: Mixed

Name Type Purpose
None

Returns the value at the current read position without advancing it


copy()

Returns: DsWalkable

Name Type Purpose
None

Returns a copy of this DsWalkable.


is( type )

Returns: boolean (true or false)

Name Type Purpose
type Constructor The Constructor to compare this against.

Returns true if the provided type is DsWalkable.


Variables

Jump To top
  • step - the current link being read, or undefined if the list has not started yet
  • steps - the number of steps that have been taken through the list

Clone this wiki locally