[lib] List <T> - Basic

List T API

List Newactionlist name <string>, values type <preset - List Values Type>Initializes new list of given type. List name is unique per type. Creating 2 lists of int with name 'something' will not work, but 2 lists of int and string with same name will work
List Set <T>actionlist name <string>, index <integer>, value <T>Sets value at given index in given list
List Get <T>function <T>list name <string>, index <integer>Gets value at given index in given list
List Add <T>actionlist name <string>, value <T>Adds new value to the list. This also resize the list
List IndexOf <T>function <integer>list name <string>, value <T>Returns first found index with given value. Returns -1 if value is not in the list
For Each Value in List <T>actionType name <T>, list name <string>GUI Only. Preform for each loop thru given list
List Values Countfunction <integer>list name <string>, values type <preset - List Values Type>Returns count of items in given list
List Remove Atactionlist name <string>, value type <preset - List Values Type>, index <integer>Removes value at given index from given list and shrinks the list by 1
List Clearactionlist name <string>, values type <preset - List Values Type>Clears all list data including list itself
List Existfunction <boolean>list name <string>, values type <preset - List Values Type>Checks if given list exist

Note: Not all functions have safety checks but those usually won't cause issues if used wrong way.

Note 2:Any other functions really would be wrappers around those functions. IndexOf<T> already is. I simply don't want to spam GUI because there needs to be 1 function per type.

For example to remove specific value from list you would do RemoveAt(IndexOf(value)). Only missing function is InsertAt but you probably wouldn't use it anyway.
To preform basic 'for' with 'i' index you would use 'for each integer i from 0 to (List values count-1)

You must login to post a comment. Don't have an account? Register to get one!


Date created
Apr 01, 2012
Last updated
Apr 02, 2012