-
Notifications
You must be signed in to change notification settings - Fork 1
melon.iter
garryspins edited this page Feb 27, 2026
·
5 revisions
melon.iter
Contains functions relating to custom iterators
melon

melon.iter.Break()
Breaks the current iter
Only to be called inside a melon.iter.NewIter wrapped iterator

melon.iter.GetState(lvl: number) -> table?
Argument and Return information
| # | Name | Type | Description |
|---|---|---|---|
| 1 | lvl | number | How many levels down from the top should we go |
| # | Name | Type | Description |
|---|---|---|---|
| 1 | table | table | The state from the stack if it was found |
Gets a stack state from the given level, providing 0 gives you the Top

melon.iter.Goto(i: number, lvl: number)
Argument and Return information
| # | Name | Type | Description |
|---|---|---|---|
| 1 | i | number | The index to jump to |
| 2 | lvl | number | How many levels down in the stack should be run this on |

melon.iter.NewIter(input: fn) -> fn
Argument and Return information
| # | Name | Type | Description |
|---|---|---|---|
| 1 | input | fn | The iterator function |
| # | Name | Type | Description |
|---|---|---|---|
| 1 | fn | fn | The wrapped iterator function |

melon.iter.Next(offset?: number) -> any?
Argument and Return information
| # | Name | Type | Description |
|---|---|---|---|
| 1 | offset? | number | The amount to add to the current index |
| # | Name | Type | Description |
|---|---|---|---|
| 1 | any | any | The next value in the iterator |
Returns the next value in the iterator

melon.iter.ReverseArgs(any...) -> any...
Argument and Return information
| # | Name | Type | Description |
|---|---|---|---|
| 1 | any | any... | Args to reverse |
| # | Name | Type | Description |
|---|---|---|---|
| 1 | any | any... | Reversed arguments |
Reverses the given arguments

melon.iter.SetOverflowProtect(number)
Argument and Return information
| # | Name | Type | Description |
|---|---|---|---|
| 1 | number | number | How many iterations before [melon.iter.NewIter] iterators error out |
Sets the number of iterations before all iterators cancel

melon.iter.Skip(i: number, lvl: number)
Argument and Return information
| # | Name | Type | Description |
|---|---|---|---|
| 1 | i | number | How many indices to skip |
| 2 | lvl | number | How many levels down in the stack should be run this on |