Flashii Docs

(旧Railgun) if it ain't broke, we'll break it

User Tools

Site Tools


senses:packages:kmj-intervals

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
senses:packages:kmj-intervals [2025/07/28 01:38] – created flashsenses:packages:kmj-intervals [2026/04/27 00:21] (current) – removed lie flash
Line 2: Line 2:
  
 The kmj-intervals package provides access to the ability to defer execution of a function and/or have it be executed repeatedly at a given interval. The kmj-intervals package provides access to the ability to defer execution of a function and/or have it be executed repeatedly at a given interval.
- 
-The runtime provides this library through the [[https://www.lua.org/manual/5.4/manual.html#luaL_newlib|luaL_newlib]] auxiliary library function, so all fields can be assumed to be functions. 
  
 ===== create ===== ===== create =====
Line 18: Line 16:
   create(action: function, number: delay, number: times = -1): (interval: number)   create(action: function, number: delay, number: times = -1): (interval: number)
  
-=== Arguments ===+==== Arguments ====
  
   - The first argument should contain the function that is to be run at an interval or be deferred.   - The first argument should contain the function that is to be run at an interval or be deferred.
Line 24: Line 22:
   - The third argument contains the amount of times the interval should be run, if **''-1'' or any other value less than ''0''**, the interval will run indefinitely, if **''0''**, the interval creation will essentially be a no-op, **any value greater than ''0''** will have the value decrease with ''1'' every time it is run, until the value reaches ''0'' at which point it is destroyed.   - The third argument contains the amount of times the interval should be run, if **''-1'' or any other value less than ''0''**, the interval will run indefinitely, if **''0''**, the interval creation will essentially be a no-op, **any value greater than ''0''** will have the value decrease with ''1'' every time it is run, until the value reaches ''0'' at which point it is destroyed.
  
-=== Return values ===+==== Returns ====
  
   - The first return value contains a unique identifier representing the interval registration. It can be used to (prematurely) destroy it to prevent it from running further.   - The first return value contains a unique identifier representing the interval registration. It can be used to (prematurely) destroy it to prevent it from running further.
Line 36: Line 34:
   destroy(interval: number): ()   destroy(interval: number): ()
  
-=== Arguments ===+==== Arguments ====
  
   - The first argument should contain the unique identifier of an interval returned at creation.   - The first argument should contain the unique identifier of an interval returned at creation.
  
-=== Return values ===+==== Returns ====
  
 //This function does not return anything.// //This function does not return anything.//
senses/packages/kmj-intervals.1753666715.txt.gz · Last modified: by flash