Posted 19 January 2015 - 08:55 AM
Hi,
I'll start by explaining what I want to do. You know how in Windows, you can press a certain key during the boot sequence and the computer enters recovery mode? That's sort of what I'd like to do.
I'm attempting to create a very basic graphical operating system. I have a working login screen so far which willl kickstart the main program once I make that part.
What I'm trying to do now is the startup script, which is a seperate program to the login screen.
I have a false loading screen (I know it's pointless, but it provides an opportunity to enter recovery mode).
I have a function to advance the loading bar, and then launch the login program.
I also have a function which uses os.pullEvent("key") to detect a key press, and the key type. If the key type is the key ID of 'r' then the function launches the recovery mode program.
I want to run these two functions simultaneously, so that the loading bar advances while the computer also checks for a key press.
I'm not comfortable using coroutines yet, and I find the wiki page on the parallel API confusing.
Does anyone know of a way perform these functions simultaneously?
I'm typing this on an iPad late at night, so I'll post the code from my computer tomorrow if anyone would like to see it.
I'll start by explaining what I want to do. You know how in Windows, you can press a certain key during the boot sequence and the computer enters recovery mode? That's sort of what I'd like to do.
I'm attempting to create a very basic graphical operating system. I have a working login screen so far which willl kickstart the main program once I make that part.
What I'm trying to do now is the startup script, which is a seperate program to the login screen.
I have a false loading screen (I know it's pointless, but it provides an opportunity to enter recovery mode).
I have a function to advance the loading bar, and then launch the login program.
I also have a function which uses os.pullEvent("key") to detect a key press, and the key type. If the key type is the key ID of 'r' then the function launches the recovery mode program.
I want to run these two functions simultaneously, so that the loading bar advances while the computer also checks for a key press.
I'm not comfortable using coroutines yet, and I find the wiki page on the parallel API confusing.
Does anyone know of a way perform these functions simultaneously?
I'm typing this on an iPad late at night, so I'll post the code from my computer tomorrow if anyone would like to see it.