Posted 02 August 2012 - 06:25 PM
I'm fairly new to LUA, and I'm making my own OS. It's fairly simple right now, but I want to make it more complex over time. The one thing I REALLY working is coroutines, but I'm not entirely sure how to do them.
Basically, I have a function that saves all events from os.pullEventRaw() to a table (acting kind of like a stack). This is so that if any addon programs written by other decide to use sleep() then it doesnt mess up all of the events :ph34r:/>/>
I then have another function, delegateEvents(), that takes one event form the stack and handles it.
Within delegateEvents() I want to create a new thread, and start it. This thread will be whatever function delegateEvents() delegates to handle the event (whether it is rednet, key, char etc…). The function delegated should hopefully run it's course and then close itself. Is this possible in LUA?
Basically, I have a function that saves all events from os.pullEventRaw() to a table (acting kind of like a stack). This is so that if any addon programs written by other decide to use sleep() then it doesnt mess up all of the events :ph34r:/>/>
I then have another function, delegateEvents(), that takes one event form the stack and handles it.
Within delegateEvents() I want to create a new thread, and start it. This thread will be whatever function delegateEvents() delegates to handle the event (whether it is rednet, key, char etc…). The function delegated should hopefully run it's course and then close itself. Is this possible in LUA?