Skip to content

K.Value ​

Functions ​

K.Value.Define ​

lua
K.Value.Define<T>(name: string, options: Options<T>?): Value<T>

K.Value(name, options) is the same as K.Value.Define(name, options).

K.Value.Get ​

lua
K.Value.Get(name: string): Value

An existing value by name (on clients, any name).

K.Value.Exists ​

lua
K.Value.Exists(name: string): boolean

K.Value.Names ​

lua
K.Value.Names(): { string }

Methods on value ​

value:Get ​

lua
value:Get(player: Player): any

value:Set ​

lua
value:Set(player: Player, value: any, source: string?)

Returns (changed, newValue, reasonIfNot).

value:Add ​

lua
value:Add(player: Player, amount: number, source: string?)

value:Take ​

lua
value:Take(player: Player, amount: number, source: string?)

Fails, changing nothing, when the result would go below Min.

value:Has ​

lua
value:Has(player: Player, amount: number): boolean

True when Take(player, amount) would work.

value:OnChanged ​

lua
value:OnChanged(callback: (Player, any, any) -> ())

callback(player, new, old) on every change.

value:Before ​

lua
value:Before(operation: string, callback: (any) -> (), priority: number?): () -> ()

Runs before an operation on this value. Change ctx.Amount, or ctx:Cancel("reason").

value:After ​

lua
value:After(operation: string, callback: (any) -> ()): () -> ()

Runs after an operation on this value succeeded; ctx.Old and ctx.New hold the values.

value:Use ​

lua
value:Use(operation: string, callback: (any, () -> ()) -> (), priority: number?): () -> ()

Full middleware: callback(ctx, next). Call next() to continue, or don't to stop.

value:Override ​

lua
value:Override(operation: string, callback: (any) -> boolean?)

Replaces what an operation does for this value. Call ctx:Commit(value) to apply, or return false to fail.

Generated from src/Corode/Value.luau.

Corode 0.13.0 · MIT License