From 628fafdc1b2de7151c8a561632ce04da4404ba0a Mon Sep 17 00:00:00 2001 From: liquidev Date: Fri, 25 Oct 2024 23:26:07 +0200 Subject: [PATCH] docs/system: document `len` and `index` --- docs/system.dj | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/docs/system.dj b/docs/system.dj index b6abfd7..ec7c3e3 100644 --- a/docs/system.dj +++ b/docs/system.dj @@ -602,6 +602,29 @@ stroke 128 #00000004 (vec 0 0) If you try to to use this brush to fill up a single spot with black, you will notice that despite all the math suggesting so, the color will end up gray instead. +## Lists + +```haku +len + l : list _ + -> number +``` + +Returns the number of elements in the given list (its `len`gth.) + +```haku +index + l : list t + i : number + -> t +``` + +Returns an element of the list, located at the given index `i`. +The first element is located at index 0. + +Indexing out of bounds is an error. + + ## Shapes ```haku