Skip to content

Passing data between GD.yield() and resume() #14

Closed
@gilzoide

Description

@gilzoide

Discussed in #13

Originally posted by Alikae January 27, 2022
Hi !
I would like to know if there is currently a way to pass data between between GD.yield() and the corresponding resume().
All my tests so far behave as if GD.yield() always return nil, regardless of how I call resume().

Wanted usage:
script a:

b.test()
b.resume('data')

script b:

function test()
a = GD.yield()
print(a) -- print data

Is there something I missed about how to use it ?
Is this maybe not an intended feature ? The wanted behavior is easily reproduced by changing

b.resume('data')

by

b.some_prop = 'data'
b.resume()

Lastly, I came to the sources to try to understand it by myself, but I stumbled upon coroutine.resume and coroutine.yield, that (in my understanding) doesn't seems to be defined anywhere. Does it come from Godot API ? If so, do you know where I can find some documentation about it ? Pretty hard to find Godot documentation that do more than scratching the surface.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions