neoneo-go/pkg/core/interop/iterator/interop.go

24 lines
651 B
Go
Raw Normal View History

package iterator
import (
"github.com/nspcc-dev/neo-go/pkg/core/interop"
"github.com/nspcc-dev/neo-go/pkg/vm"
)
// Create creates an iterator from array-like or map stack item.
2020-08-07 11:37:49 +00:00
func Create(ic *interop.Context) error {
return vm.IteratorCreate(ic.VM)
}
// Next advances the iterator, pushes true on success and false otherwise.
func Next(ic *interop.Context) error {
return vm.IteratorNext(ic.VM)
}
// Value returns current iterator value and depends on iterator type:
// For slices the result is just value.
// For maps the result is key-value pair packed in a struct.
func Value(ic *interop.Context) error {
return vm.IteratorValue(ic.VM)
}