diff --git a/commons-provider/src/main/kotlin/xyz/xenondevs/commons/provider/mutable/BasicProviders.kt b/commons-provider/src/main/kotlin/xyz/xenondevs/commons/provider/mutable/BasicProviders.kt index 821252b..1f0ee17 100644 --- a/commons-provider/src/main/kotlin/xyz/xenondevs/commons/provider/mutable/BasicProviders.kt +++ b/commons-provider/src/main/kotlin/xyz/xenondevs/commons/provider/mutable/BasicProviders.kt @@ -11,6 +11,14 @@ fun mutableProvider(initialValue: T): MutableProvider = override fun loadValue(): T = initialValue } +/** + * Creates a new [MutableProvider] that loads its value using the given [loadValue] function. + */ +fun mutableProvider(loadValue: () -> T): MutableProvider = + object : AbstractProvider() { + override fun loadValue(): T = loadValue() + } + /** * Creates a new [MutableProvider] that loads its value using the given [loadValue] function * and sets it using the given [setValue] function.