User Tools

Site Tools


addons:using_libs:timer

Timer Library (Module)

The timer library implements helpful functions to create timer based function calls for addons.

The following functions are exposed by this library:

void timer.RemoveTimer(string name);

  • Parameters
    • name - The name of the timer to remove.
  • Returns
    • Function does not return a value.

boolean timer.IsTimer(string name);

  • Parameters
    • name - The name of the timer to lookup.
  • Returns
    • True if it exists, false otherwise.

boolean timer.Once(number delay, function func, paramlist …);

  • Parameters
    • delay - The delay before the timer should fire.
    • func - The function to execute when the timer is triggered.
    • … - The arguments to pass to the function when its called.
  • Returns
    • True when created.

void timer.Create(string name, number delay, number reps, function func, paramlist …);

  • Parameters
    • name - The name of the timer to create.
    • delay - The delay between each tick of the timer.
    • reps - The number of times the timer should occur. (0 for infinite.)
    • func - The function to execute when the timer is triggered.
    • … - The arguments to pass to the function when its called.
  • Returns
    • Function does not return a value.

boolean timer.StartTimer(string name);

  • Parameters
    • name - The name of the timer to start.
  • Returns
    • True on success, false otherwise.

boolean timer.AdjustTimer(string name, number delay, number reps, function func, paramlist …);

  • Parameters
    • name - The name of the timer to adjust.
    • delay - The new delay for the timer.
    • reps - The new reps for the timer.
    • func - The new function for the timer.
    • … - The new arguments for the timer.
  • Returns
    • True on success, false otherwise.

boolean timer.Pause(string name);

  • Parameters
    • name - The name of the timer to pause.
  • Returns
    • True on success, false otherwise.

boolean timer.Unpause(string name);

  • Parameters
    • name - The name of the timer to unpause.
  • Returns
    • True on success, false otherwise.

boolean timer.Toggle(string name);

  • Parameters
    • name - The name of the timer to toggle.
  • Returns
    • True on success, false otherwise.

boolean timer.Stop(string name);

  • Parameters
    • name - The name of the timer to stop.
  • Returns
    • True on success, false otherwise.

boolean timer.Pulse(string name);

  • Parameters
    • name - Unused parameter.
  • Returns
    • True on success, false otherwise.
addons/using_libs/timer.txt · Last modified: 2015/11/20 00:07 by atom0s