TheEisbaer 0 Posted September 19, 2015 Share Posted September 19, 2015 Hello, I am trying to use an API and a Programm I used in CC in OC: API : http://pastebin.com/NAsCJ5Es Program: http://pastebin.com/kepHTh4d Error: http://puu.sh/kh5qR/861622b8d7.png Where am I going wrong? How do I fix it? Thank your very much for help Quote Link to post Share on other sites
0 Gangsir 14 Posted September 21, 2015 Share Posted September 21, 2015 I'm no expert in libraries or coroutines, though the way you have the library set up is incorrect for OC. Fixed: http://pastebin.com/21vvAxUh Note that all I did was make it so OC recognises the library and require() returns a table of functions instead of a boolean. I can't guarantee that the code that pre-existed works. I don't really know much about coroutines. Try it out and notice my changes, see if it works. Quote Link to post Share on other sites
0 natedogith1 4 Posted September 22, 2015 Share Posted September 22, 2015 Aside from what Gangsir fixed, os.pullEventRaw doesn't exist in OC. Also, computer.pullSignal skips over all user created coroutines (so you'd need to override computer.pullSignal or event.pullFiltered to call coroutine.yield). Quote Link to post Share on other sites
0 dgelessus 26 Posted September 22, 2015 Share Posted September 22, 2015 Also, computer.pullSignal skips over all user created coroutines Just curious, what exactly do you mean with that? Coroutines aren't like threads, Lua doesn't automatically run them concurrently. Logically if you call computer.pullSignal in one coroutine, that will block all execution, even if you have some kind of "manual threading" (Plan9k). Quote Link to post Share on other sites
0 natedogith1 4 Posted September 22, 2015 Share Posted September 22, 2015 Just curious, what exactly do you mean with that? Coroutines aren't like threads, Lua doesn't automatically run them concurrently. Logically if you call computer.pullSignal in one coroutine, that will block all execution, even if you have some kind of "manual threading" (Plan9k). OpenComputer wraps calls to coroutine.yield and coroutine.resume so that they can bubble sysyields. It's part of how OC handles component methods. (if you want to look at the code that does the yielding stuff you can check here ) Quote Link to post Share on other sites
0 dgelessus 26 Posted September 23, 2015 Share Posted September 23, 2015 OpenComputer wraps calls to coroutine.yield and coroutine.resume so that they can bubble sysyields. It's part of how OC handles component methods. (if you want to look at the code that does the yielding stuff you can check here ) Yes, I "knew" that (i. e. I read that piece of code once before). Though I don't understand how this relates to computer.pullSignal and "skipping" coroutines. Quote Link to post Share on other sites
0 natedogith1 4 Posted September 24, 2015 Share Posted September 24, 2015 Yes, I "knew" that (i. e. I read that piece of code once before). Though I don't understand how this relates to computer.pullSignal and "skipping" coroutines. computer.pullSignal uses the bubbling yield (rather than the user-exposed yield) Quote Link to post Share on other sites
0 dgelessus 26 Posted September 24, 2015 Share Posted September 24, 2015 By "skipping" do you mean that computer.pullSignal's yield cannot be "caught" by user code? Quote Link to post Share on other sites
0 natedogith1 4 Posted September 24, 2015 Share Posted September 24, 2015 By "skipping" do you mean that computer.pullSignal's yield cannot be "caught" by user code? That's precisely what I mean. Quote Link to post Share on other sites
0 dgelessus 26 Posted September 24, 2015 Share Posted September 24, 2015 That's precisely what I mean. Oh, then I was just understanding you wrong before. Sorry for being a derp (and derailing the thread) (Huh, I'm a "Leading Member" now? Neat.) Quote Link to post Share on other sites
Hello,
I am trying to use an API and a Programm I used in CC in OC:
API :
http://pastebin.com/NAsCJ5Es
Program:
http://pastebin.com/kepHTh4d
Error:
http://puu.sh/kh5qR/861622b8d7.png
Where am I going wrong?
How do I fix it?
Thank your very much for help
Link to post
Share on other sites