Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
with the passed name. Properties are considered available if they are found in
the result of `ClassDB:class_get_property_list`.

### Fixed

- Return values passed to `lps_coroutine:resume(...)` when calling `GD.yield()`.

### Changed

- **BREAKING CHANGE**: `Array` and `Pool*Array`'s `__index` and `__newindex`
Expand Down
2 changes: 1 addition & 1 deletion src/late_globals.lua
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ function GD.yield(object, signal_name)
if object and signal_name then
object:connect(signal_name, co_obj, "resume", Array(), Object.CONNECT_ONESHOT)
end
coroutine_yield(co_obj)
return coroutine_yield(co_obj)
end

local Engine = api.godot_global_get_singleton("Engine")
Expand Down
17 changes: 17 additions & 0 deletions src/test/coroutines.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
local lu = require "luaunit"

local Test = {}

function Test:return_yield()
return GD.yield()
end

function Test:test_yield_results()
local coro = self:call('return_yield')
lu.assert_nil(coro:resume())

local coro = self:call('return_yield')
lu.assert_equals(coro:resume(42), 42)
end

return Test