User Tools

Site Tools


modding:function:item

item

item

item

Syntax (item list index) → list item or Nil
Arguments list: the list you want to get an element from.
index: the integer position of the element you want to get.
Returns If index is less than zero, return first element. If the index is greater or equal than the length of the list, return Nil. Otherwise return the element at given index in the list.
Category list
Description A function to return an element from a list.
IMPORTANT: *The list count starts from 0, so, the index of the first element is 0*

Very important list function.

Example

(item '(a (b e) (c d) d) 2)

Returns (c d).

(item '(a b c d) 0)

Returns a.

(item '(a b c d) -1)

Returns a.

(item '(a b c d) 4)

Returns Nil.

Return to Functions list

modding/function/item.txt · Last modified: 2014/12/27 04:40 by 127.0.0.1