• Print

Author Topic: New timers!  (Read 4 times)

0 Members and 1 Guest are viewing this topic.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
New timers!
« on: November 06, 2006, 04:11:14 pm »
I know it wasn't exactly on our todo list, but I just couldn't help myself from making a better timer function for ULib.

Here's some output  ;D
Quote
] lua ULib.addTimer( 1, 5, function () ULib.nonexist() end )
Lua Error: Line 1: attempt to call field 'nonexist' (a nil value)
[ULib timer] You probably just saw an error, this error came from timerid 1   
Lua Error: Line 1: attempt to call field 'nonexist' (a nil value)
[ULib timer] You probably just saw an error, this error came from timerid 1   
Lua Error: Line 1: attempt to call field 'nonexist' (a nil value)
[ULib timer] You probably just saw an error, this error came from timerid 1   
Lua Error: Line 1: attempt to call field 'nonexist' (a nil value)
[ULib timer] You probably just saw an error, this error came from timerid 1   
Lua Error: Line 1: attempt to call field 'nonexist' (a nil value)
[ULib timer] You probably just saw an error, this error came from timerid 1   
] lua ULib.addTimer( 1, 5, ULib.print, "yay" )
yay   
yay   
yay   
yay   
yay   

You'll notice that not only is it able to keep processing timed functions if one screws up, it gives you the error message as well (Gmod's timer doesn't even tell you there was a problem).
Experiencing God's grace one day at a time.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: New timers!
« Reply #1 on: November 06, 2006, 05:52:52 pm »
Nice!

Oh. Just thought of something...you _are_ updating Ulib docs at http://ulyssesmod.net/docs/files/readme-txt.html as you add to Ulib, right?
:P
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

  • Print