diff --git a/src/main/kotlin/dev/nextftc/bindings/Button.kt b/src/main/kotlin/dev/nextftc/bindings/Button.kt index 2f69d0c..4b025a5 100644 --- a/src/main/kotlin/dev/nextftc/bindings/Button.kt +++ b/src/main/kotlin/dev/nextftc/bindings/Button.kt @@ -68,7 +68,7 @@ class Button(private val valueSupplier: Supplier) : Supplier { class Named(val name: String?) : Layer } - private var value: Boolean = valueSupplier.get() + private var value: Boolean = false private var previousValue = value /** diff --git a/src/main/kotlin/dev/nextftc/bindings/Variable.kt b/src/main/kotlin/dev/nextftc/bindings/Variable.kt index d34d9d8..292bbe9 100644 --- a/src/main/kotlin/dev/nextftc/bindings/Variable.kt +++ b/src/main/kotlin/dev/nextftc/bindings/Variable.kt @@ -32,12 +32,12 @@ import java.util.function.Supplier * @see Range for creating a double variable with number-specific utilities. */ open class Variable(private val valueSupplier: Supplier) : Supplier { - 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