Jump to content




ComputerCraft Event System Flowchart


7 replies to this topic

#1 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 02 April 2016 - 02:58 AM

I decided to make a visual of the event system. It's not by any means perfect, but I'd like to say it's pretty nice.

Posted Image

Made with lucidchart.

Edited by KingofGamesYami, 04 April 2016 - 01:52 AM.


#2 wilcomega

  • Members
  • 466 posts
  • LocationHolland

Posted 02 April 2016 - 11:40 PM

Could have used this when i was making blueframes :P this makes lifes easier

#3 Lupus590

  • Members
  • 2,029 posts
  • LocationUK

Posted 03 April 2016 - 06:28 PM

This could be a handy image for learning how to use coroutines, or for anyone making a tutorial on the usage of coroutines (@BombBloke this may break up your wall of text quite nicely)

#4 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 03 April 2016 - 10:12 PM

It's a pretty good graphic. I assume you don't mind if I yoink it?

#5 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 03 April 2016 - 10:15 PM

Go ahead; however it'd be good to keep in mind the image updates if I make changes to the flowchart. I won't remove anything, but I am considering adding to it.

Actually, while we're on the subject: Is there anything in particular I should add?

Edited by KingofGamesYami, 04 April 2016 - 12:02 AM.


#6 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 04 April 2016 - 01:10 AM

I'd be inclined to expand on "waiting for an event" - you don't really do that if there're already events in the queue. There's also the matter of resuming other coroutines the manager may be handling.

You may also consider adding arrows for cases where os.pullEventRaw() is bypassed by calling coroutine.yield() directly. Adding columns for coroutine.yield() and coroutine.resume() may help you better visualise how data goes in/out of the coroutine.

#7 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 04 April 2016 - 01:47 AM

I have modified my graphic to better describe how waiting for events works, including a separate process which adds events to the queue as the occur.

I also added a part which shows at which point other coroutines are resumed; I'm not sure if that's adequate or if I should have a better indicator that this process happens for each one.

The arrows for coroutine.yield() have been added, however I did not add columns for yield / resume. I just can't visualize how that would work, in my mind they are essentially the same; an analogy I would use to describe them is the sides of a coin (heads/tails).

Finally, I added how errors work. This added a lot of stuff. Unfortunately I have lines that cross, I'll work on sorting that out without adding a lot of whitespace or making the arrows extremely ugly.

#8 cmdpwnd

  • Members
  • 128 posts
  • LocationHere

Posted 05 April 2016 - 03:13 AM

This makes life so much easier when writing coroutines! Actually with this much detail I actually think I could pretty easily write a non-coroutine program that still functions rather similarly to coroutines. ....... I think I will. hehe :)

Thank you so much for making this!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users