This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
4rpl:commands:list [2025/02/14 14:57] – external edit 127.0.0.1 | 4rpl:commands:list [2025/09/02 21:05] (current) – [Examples] kalli | ||
---|---|---|---|
Line 15: | Line 15: | ||
trace(GetListCount(< | trace(GetListCount(< | ||
</ | </ | ||
+ | |||
+ | When building a list, there is a risk that there are items left on the stack before you start building your list. If you know your list length, then you can use listN. If you don't, then you need to clear the stack before starting to build your new list. __To prevent this:__ ClearStack will throw away the old stack, but if you want to save the old stack instead, then you can use the functions below. | ||
+ | <code 4rpl> | ||
+ | " | ||
+ | @saveOldStack | ||
+ | List(1 2 3) ->list | ||
+ | @loadOldStack | ||
+ | traceallsp | ||
+ | |||
+ | : | ||
+ | stacksize if list -> | ||
+ | |||
+ | : | ||
+ | < | ||
+ | stacksize if list -> | ||
+ | < | ||
+ | < | ||
+ | |||
+ | |||
+ | </ | ||
+ | |||
< | < | ||