set

open fun set(@NotNull key: @NotNull String, value: Float)

Binds a fixed numeric value to a Molang query in this context. The default implementation ignores the binding.


context.set("health", 20F);

Since

3.7.0

Parameters

key

the query name without the query. or q. prefix

value

the value to return when the query is read


open fun set(@NotNull key: @NotNull String, @NotNull function: @NotNull KeyframeRuntimeContext.FloatFunction)

Binds a Molang query to a function that accepts zero to three numeric arguments. The matching setFunction overload handles the function according to its arity. The default implementation ignores the binding.


context.set("distance", (x, y, z) -> (float) Math.sqrt(x * x + y * y + z * z));

Since

3.7.0

Parameters

key

query name without query. or q. prefix

function

function that computes the query value