14 lines
290 B
GDScript
14 lines
290 B
GDScript
class_name SingletonIterator extends Iterator
|
|
|
|
var value: Variant
|
|
var emitted: bool = false
|
|
|
|
func _init(value: Variant) -> void:
|
|
self.value = value
|
|
|
|
func next() -> Option:
|
|
if not emitted:
|
|
emitted = true
|
|
return Option.some(value)
|
|
else:
|
|
return Option.none
|