co function init(self) co.yield_seconds(1) co.yield_frames(1) co.yield_until_true(function() return (self.lives < 0) end) for _,var in pairs(array) do go.animate(....) co.yield_seconds(0.5) end end
Here I also added a “co” module as well to work with the basic flow functions. But by making this a concept of the editor, much the same as the msg module. It would encourage more developers to work in this fashion with cinematic functions.
In addition, this could also enable a reactive design where results are passed back from functions rather than callbacks if wrapped in a coroutine. But unlike the other this would be a breaking change, so would require a game.project checkbox for migration.
co function init(self) local id, response = http.request("www.google.com", "GET") print("Call finished") end function init(self) http.request("www.google.com", "GET", function(self, id, response) print("Call finished") end) end