Notation

Value stacks

This document uses the following stack notation. Stacks are represented visually with the stack growing to the right. For instance, after:

duk_push_number(ctx, 123);
duk_push_string(ctx, "foo");
duk_push_true(ctx);

the stack would look like:

[ 123 "foo" true ]

The elements on the stack which don't affect the operation are denoted with a single element with ellipsis ("..."):

[ ... ]

The elements actively operated on, either being read, written, inserted, or removed, have a white background:

[ ... obj! key! ]

Elements which are identified by an explicit index in an API call are indicated with surrounding ellipsis elements, to emphasize that they may be anywhere in the stack:

[ ... obj! ... key! value! ]

In some cases the index of an element may be emphasized with a number or symbolic value in parenthesis:

[ ... val(index)! val(index+1)! ... ]

Stack transformation is represented with an arrow and two stacks:

[ ... obj! ... key! value! ] -> [ ... obj! ... ]