Jump to content




[LUA] Problems with a boot loader...

lua

  • You cannot reply to this topic
7 replies to this topic

#1 Oct125

  • Members
  • 49 posts

Posted 07 January 2013 - 10:34 AM

I'm creating a boot loader for my OS, but i'm having problems... He have a countdown, but when the count Reaches 0, the boot loader doesn't stop... If i press any key that i'm using in the boot loader (arrows), the boot loader restart and reboot the os... So i have to stop him! And i don't know how do this... And when i select another item, the boot loader start a new count, and don't stop the old...

Here's the code:
Spoiler

Some one can help me?

#2 Goof

  • Members
  • 751 posts

Posted 07 January 2013 - 11:32 AM

Your term.cleaLine(6,14) should be
term.clearLine() -- Without Any arguments.
Edit. Dont listen to this!

Your term.clearLine(6,14) is throwing an error, which shuts down the system, before you should know it.
and you should call your parallel.waitForAny() after the two functions :
Like :


function() -- make a name for the function. Like:

function start1()
--- Do stuff

end
function time()
timer()
end
parallel.waitForAny(start1, time)

I think that would solve the problem :P/>


:D/>

#3 Orwell

    Self-Destructive

  • Members
  • 1,091 posts

Posted 07 January 2013 - 11:40 AM

View PostMikk809h, on 07 January 2013 - 11:32 AM, said:

Your term.cleaLine(6,14) should be
term.clearLine() -- Without Any arguments.

Your term.clearLine(6,14) is throwing an error, which shuts down the system, before you should know it.
and you should call your parallel.waitForAny() after the two functions :
Like :


function() -- make a name for the function. Like:

function start1()
--- Do stuff

end
function time()
timer()
end
parallel.waitForAny(start1, time)

I think that would solve the problem :P


:D
You're wrong twice. You can perfectly call term.clearLine(6,14), it will just ignore the parameters. You can also perfectly define the functions within the call to parallel.waitForAny. Thus the problem is something different. If no one finds it soon, I will take a look myself.

#4 Oct125

  • Members
  • 49 posts

Posted 07 January 2013 - 12:18 PM

View PostMikk809h, on 07 January 2013 - 11:32 AM, said:

Your term.cleaLine(6,14) should be
term.clearLine() -- Without Any arguments.

Your term.clearLine(6,14) is throwing an error, which shuts down the system, before you should know it.
and you should call your parallel.waitForAny() after the two functions :
Like :


function() -- make a name for the function. Like:

function start1()
--- Do stuff

end
function time()
timer()
end
parallel.waitForAny(start1, time)

I think that would solve the problem :P


:D
Well... Thanks anyway...

View PostOrwell, on 07 January 2013 - 11:40 AM, said:

View PostMikk809h, on 07 January 2013 - 11:32 AM, said:

Your term.cleaLine(6,14) should be
term.clearLine() -- Without Any arguments.

Your term.clearLine(6,14) is throwing an error, which shuts down the system, before you should know it.
and you should call your parallel.waitForAny() after the two functions :
Like :


function() -- make a name for the function. Like:

function start1()
--- Do stuff

end
function time()
timer()
end
parallel.waitForAny(start1, time)

I think that would solve the problem :P


:D
You're wrong twice. You can perfectly call term.clearLine(6,14), it will just ignore the parameters. You can also perfectly define the functions within the call to parallel.waitForAny. Thus the problem is something different. If no one finds it soon, I will take a look myself.

Ok!

#5 Goof

  • Members
  • 751 posts

Posted 07 January 2013 - 07:35 PM

Oh then im really sorry, for posting wrong info...
i didnt really know that it would ignore the parametres.
And the parallel: i just think that it would be easier to just make two words in the paratheses.. ::-/
sorry.

#6 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

Posted 07 January 2013 - 09:23 PM

View PostMikk809h, on 07 January 2013 - 07:35 PM, said:

And the parallel: i just think that it would be easier to just make two words in the paratheses.. ::-/
sorry.

It is but it's really up to the coder to do what he wants :)

I'm busy looking it at it now and I see you call text() within text() within the parallel.waitForAny(). Will that not give a stack overflow at times, or maybe the time will run out in time..

edit: I think the problem does lie within the parallel function, where you call text() all the time. Weird that the time keeps changing seconds, maybe you should have used a for loop for the timer function.

Also, if you don't know about Tables, you should learn about them and use them a lot, they are really useful.

Check this out:

Spoiler


#7 Oct125

  • Members
  • 49 posts

Posted 08 January 2013 - 05:52 AM

View PostMikk809h, on 07 January 2013 - 07:35 PM, said:

Oh then im really sorry, for posting wrong info...
i didnt really know that it would ignore the parametres.
And the parallel: i just think that it would be easier to just make two words in the paratheses.. ::-/
sorry.
It's ok! You just trying to help ;)

View PostremiX, on 07 January 2013 - 09:23 PM, said:

View PostMikk809h, on 07 January 2013 - 07:35 PM, said:

And the parallel: i just think that it would be easier to just make two words in the paratheses.. ::-/
sorry.

It is but it's really up to the coder to do what he wants :)

I'm busy looking it at it now and I see you call text() within text() within the parallel.waitForAny(). Will that not give a stack overflow at times, or maybe the time will run out in time..

edit: I think the problem does lie within the parallel function, where you call text() all the time. Weird that the time keeps changing seconds, maybe you should have used a for loop for the timer function.

Also, if you don't know about Tables, you should learn about them and use them a lot, they are really useful.

Check this out:

Spoiler

Thanks! This will help a lot! I'll put your name on the credits session ;)

And i modified the code a little to, for example, bypass the boot loader if a function in my os it is activated...

#8 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

Posted 08 January 2013 - 06:37 AM

View PostOct125, on 08 January 2013 - 05:52 AM, said:


--snip

Thanks! This will help a lot! I'll put your name on the credits session ;)

And i modified the code a little to, for example, bypass the boot loader if a function in my os it is activated...

No prob :) Cool :) And once again, forum screws up the spacing within the prints -_-





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users