# cp.fn.prop

A module of free-standing functions for working with cp.prop values.


# API Overview

Functions - API calls offered directly by the extension

  • mutate

# API Documentation

# Functions

# mutate

Signature cp.fn.prop.mutate(getFn[, setFn]) -> function(prop) -> cp.prop
Type Function
Description A function combinator which returns a function that receives a cp.prop and creates a mutated cp.prop based on the getFn and setFn provided.
Parameters
  • getFn - A function that receives the current value and returns the modified value of the prop.
  • setFn - (optional) A function that receives the modified value, along with the current value of the prop and returns a original value of the prop.
Returns
  • A cp.prop that is the result of the mutation.
Notes
  • Unlike cp.prop:mutate(...), the getFn receives the actual current value when called, rather than the cp.prop itself, and no additional parameters.
  • Also unlike cp.prop:mutate(...), the setFn is called with the mutated value and the current value, rather than the cp.prop itself, and no additional parameters.
Examples None
Source src/extensions/cp/fn/prop.lua line 9