Comments (1)
I have taken a look at your code and added an example in the examples folder. There was a slight problem with the parallel function which I have fixed.
In parallel, each of the functions that runs gets its own new rope, which use should use to control the timing.
bundle(function(rope)
rope:parallel(
function(ropea)
print "First"
-- Don't do rope:wait(0.5)
ropea:wait(0.5)
end,
function(ropeb)
print "Second"
-- Don't do rope:wait(1.5)
ropeb:wait(1.5)
end
)
print "Last"
end)
While Lua coroutines are powerful, there are some limitations in jumping between them. One can only manipulate a rope within a single coroutine (there is a 1 to 1 correspondence with coroutines and ropes). When trying to wait on the original rope inside the parallel function, you are in a different coroutine (the one corresponds to ropea or ropeb). Fortunately, we can create as many ropes as we want and wait on those ropes.
from corope.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from corope.