EDIT: Actual topic changed. Please read below quote regarding topic change. (Not making a new thread unless needed.)
I'm really appreciative of all the help, but I guess I'd like to shift this from a "how do I fix this" thread to a "how do I properly and cleanly do what I'm trying to do" thread. I'm gonna re-write the whole code, so how could I properly code something which parts could be dynamic and the entire UI be somewhat modular for simple upkeep (from pastebin code)?
If the use of shell.run and executing of other programs within programs themselves won't do (since it's obviously an improper "glue and popsicle sticks" method, even I realize that), how can I have parts of the UI download the latest updated pastebin code so key parts (like the updater, for example) stay up to date?
——————————————————————————————————————————————————————————————————————————–
I've tried looking at my code for a fix for the newest version of a personal project I'm taking on for a while, and I'm stuck.
The code in question? These are the main culprits:
http://pastebin.com/nH3LzJg1
http://pastebin.com/JUhsDLDd
http://pastebin.com/dM9PFG97
You can see in v0.4u how it's supposed to behave, at least what the user sees.
However, I'm having a few issues with v0.5u under the hood.
Basically, with v0.5u I've tried optimizing the code with global functions (found in 'startup') and local functions, but I'm experiencing 2 major issues (1 reoccurring that I thought I delt with in v0.4u, 1 new).
The reoccurring issue I've had is when the function 'runShell()' gets executed (by function 'rDP1') after having run the 'updater' program and going back to the desktop, the loop does not fully break. I've tried various methods, and the only solid way I've broken the loop is with an error, which obviously isn't clean. I tried changing the 'runDesktop()' function to run on a repeat loop rather than a while loop, stopping when the variable 'desk' is set to false (which happens in 'rDP1()'). This originally worked even though there was a slight delay, but it seems the issue is back, and I can't figure out how to fix it this time.
Things I've noticed about this issue:
-It only happens when another program gets opened, then when the 'desktop' program gets executed again
-When the loop won't break, after any click/button press 'desktop' continues functioning like normal (well, it would, if it weren't for the next issue I've found…)
The second issue I'm having is after any menu is opened and then 'rDE()' gets run to clear the menu and prepare 'runDesktop()' for the next selection from the user, the desktop locks up except for the clock. The only reason why I think this may be happening is the 'parallel.waitForAll' code near the end of the 'desktop' program. Still, no clue as to why this is happening.
I've tried several different things, attempted fixing it with numerous failed attempts, and frankly, I'm stuck.
I hate to ask, but what can I do to fix these two issues, or at least, what's causing them in my v0.5u code? (And would implementing os.pullEventRaw into 'desktop' cause any other issues? Not quite sure since I haven't been able to tell with these issues present.) As a computercraft novice, all help is obviously welcome.
Many thanks in advance.