ZudoHackz, on 03 September 2013 - 01:31 AM, said:
............... ugh. remove the fs.combine, just put ""/.melted/init/"..initf[i]" in the second argument of os.run... that should work, if it isn't you're not typing it right and OS run isn't getting the second argument...
ZudoHackz, on 03 September 2013 - 01:31 AM, said:
Not really.

Ok... how can I simplify this............. Ok got it (I hope)...
You know how when we turn on a computer, the shell is running, then when we run a program that program then takes over and we don't see the shell again until the program completes?
This is because the shell calls our program via os.run, just like if we were to do a function call.
local function one()
while true do
print("one")
sleep(0)
end
end
local function two()
print("two")
end
two()
one()
two()
The function two runs the first time, then when function one runs, we cannot call function two for the second time until function one has completed. Or to do an example similar to what you're doing.
local funcs = {
function() print("one") sleep(0.5) end,
function() print("two") sleep(0.5) end,
function() while true do print("haha! I have control now!") end end,
function() print("four") end,
function() print("five") end
}
for i = 1, #funcs do
pcall( funcs[i] )
end
With the above code, "one" and "two" will print immediately, but from then on all we will see is "haha! I have control now!" and we will not see "four" or "five" printed until the third one is stopped by CC with the "too long without yielding" error (since I didn't have it yield).
The same applies for os.run... os.run will load a file and then run it, all control is given to that program that it's running and the program that called os.run must wait for the program to finish before it may continue. Just like what we experience in the shell; the shell won't run again until our program is finished running, because our program has control.
The main point of os.run is to be able to specify a custom environment for the program to run inside of. shell.run actually just calls os.run with the shell's environment.
EDIT:
Therefore, if we want multiple things to run at once with os.run, we do it like anything else, we use the parallel api. To put it in an example like the first one, we would change
two()
one()
two()
into
parallel.waitForAll( two, one, two )
which is something you should be familiar with or at least seen before.
Edited by theoriginalbit, 03 September 2013 - 01:50 AM.