Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/kotlin/dev/nextftc/bindings/Button.kt
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class Button(private val valueSupplier: Supplier<Boolean>) : Supplier<Boolean> {
class Named(val name: String?) : Layer
}

private var value: Boolean = valueSupplier.get()
private var value: Boolean = false
private var previousValue = value

/**
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/dev/nextftc/bindings/Variable.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ import java.util.function.Supplier
* @see Range for creating a double variable with number-specific utilities.
*/
open class Variable<T>(private val valueSupplier: Supplier<T>) : Supplier<T> {
private var value: T = valueSupplier.get()
private var value: T? = null

/**
* Gets the cached value of the variable. The cached value is updated when [update] is called.
*/
override fun get(): T = value
override fun get(): T = value ?: error("Variable not updated; call update() first")

/**
* Creates a new [Variable] that maps the value of this variable using the given [mapper] and registers it with
Expand Down