Module CounterUnit
Cycle its output signal over a set of n-plugs, incrementing the activate plug by one step at each impulse received on its IN plug.
Element class: CounterUnit
Extends: Element
Functions
getCounterState () | Deprecated: Returns the rank of the currently active OUT plug. |
getIndex () | Returns the index of the current active output plug. |
getMaxIndex () | Returns the maximum index of the counter. |
next () | Deprecated: Moves the counter one step further (equivalent to signal received on the IN plug). |
nextIndex () | Moves the next counter index. |
setIndex (index) | Sets the counter index. |
setSignalIn (plug, state) | Set the value of a signal in the specified IN plug of the element. |
getSignalIn (plug) | Return the value of a signal in the specified IN plug of the element. |
getSignalOut (plug) | Return the value of a signal in the specified OUT plug of the element. |
mockGetClosure () | Mock only, not in-game: Bundles the object into a closure so functions can be called with "." instead of ":". |
Functions
- getCounterState ()
-
Deprecated: Returns the rank of the currently active OUT plug.
This method is deprecated: getIndex should be used instead
Returns:
-
The index of the active plug.
See also:
- getIndex ()
-
Returns the index of the current active output plug.
Returns:
-
int
The index of the active plug (1-indexed, so a 2 counter can return 1 or 2).
- getMaxIndex ()
-
Returns the maximum index of the counter.
Returns:
-
int
The maximum index (0-indexed, so a 2 counter returns 1).
- next ()
-
Deprecated: Moves the counter one step further (equivalent to signal received on the IN plug).
This method is deprecated: nextIndex should be used instead
See also:
- nextIndex ()
- Moves the next counter index.
- setIndex (index)
-
Sets the counter index.
Parameters:
- index int The index of the plug to activate (1-indexed, so valid inputs for a 2 counter are 1 and 2).
- setSignalIn (plug, state)
-
Set the value of a signal in the specified IN plug of the element.
Valid plug names are:
- "in" for the in signal (seems to have no actual effect when modified this way).
Parameters:
- plug string A valid plug name to set.
- state 0/1 The plug signal state
- getSignalIn (plug)
-
Return the value of a signal in the specified IN plug of the element.
Valid plug names are:
- "in" for the in signal.
Parameters:
- plug string A valid plug name to query.
Returns:
-
0/1
The plug signal state
- getSignalOut (plug)
-
Return the value of a signal in the specified OUT plug of the element.
Valid plug names are:
- "OUT-signal-<i>" where <i> is replaced by a number from 0 to the counter number minus 1 (so range of [0,4] for a 5 Counter).
Parameters:
- plug string A valid plug name to query.
Returns:
-
0/1
The plug signal state
- mockGetClosure ()
-
Mock only, not in-game: Bundles the object into a closure so functions can be called with "." instead of ":".
Returns:
-
table
A table encompasing the api calls of object.
See also: