Posted 06 July 2013 - 09:58 AM
Title: ComputerCraft Computer shuts down when multitasking…
Hey, I have createt a program that runs two while(true) loops in parallel. But always, after a few seconds (and no errors at all!) the computer (not the real one, but the ComputerCraft Computer) shuts completely down for, in my opinion, no reason.
This is the code, hope you'll understand…
thanks and best regards.
yours, greenvbuser ;)/>
by the way… I do now know that I can't post a new topic… but WHY not? Isn't it a little weird to have a forum where people cannot ask anything?
Hey, I have createt a program that runs two while(true) loops in parallel. But always, after a few seconds (and no errors at all!) the computer (not the real one, but the ComputerCraft Computer) shuts completely down for, in my opinion, no reason.
This is the code, hope you'll understand…
queue = {}
iQueue = 0
jQueue = 0
run = true
function main()
print("Running...")
parallel.waitForAll(processQueue, doQueue)
main()
end
function processQueue()
while(run == true) do
local a, message, b = rednet.receive()
queue["iQueue"] = message
if(iQueue == 16) then
iQueue = 0
else
iQueue = iQueue + 1
end
end
end
function doQueue()
while (run == true) do
if(queue["jQueue"] ~= nil) then
r=unserialize(queue["jQueue"])
if(r.target == "mww.oil-one.te/secuServer") then
rednet.sendMessage(2, s)
print("Forwarding data for "..r.target.." to Terminal '2'")
elseif(r.target == "mww.oil-one.te/mainentrance") then
rednet.sendMessage(0, queue["jQueue"])
print("Forwarding data for "..r.target.." to Terminal '2'")
end
if(jQueue == 16) then
jQueue = 0
else
jQueue = jQueue + 1
end
end
end
end
main()
thanks and best regards.
yours, greenvbuser ;)/>
by the way… I do now know that I can't post a new topic… but WHY not? Isn't it a little weird to have a forum where people cannot ask anything?