#cp.rx.go.SetProp

A Statement that will update a cp.prop value, then optionally execute other resolvables, and optionally reset the cp.prop to its previous value. This is useful for simply changing a cp.prop value without requiring a custom function(), but is extra useful when you only want to temporarily change the value.


#Submodules


#API Overview

Constructors - API calls which return an object, typically one that offers API methods

Methods - API calls which can only be made on an object returned by a constructor


#API Documentation

#Constructors

Signaturecp.rx.go.SetProp(theProp) -> SetProp
TypeConstructor
DescriptionCreates a new SetProp Statement which will update the provided cp.prop value to the specified To value.
Parameters
  • theProp - The cp.prop which will be updated.
Returns
  • The SetProp Statement.
Notes
  • It can then optionally execute some other statements and finally, reset the property to its original value.
  • Example:
  • lua</li><li>local myProp = prop.VALUE("foo")</li><li>SetProp(myProp):To("bar"):Then(</li><li> function() ... end</li><li>):ThenReset()</li><li>
ExamplesNone
Sourcesrc/extensions/cp/rx/go/SetProp.lua line 24

#Methods

Signaturecp.rx.go.SetProp:To(value) -> SetProp.To
TypeMethod
DescriptionCall this to define what value to set the property to. If it is a function or other "callable" table, it will be called with no parameters to get the actual stored value. If it is any other value, it will be set as is.
Parameters
  • value - The value or "callable" to update the prop to.
Returns
  • The SetProp.To Statement.Modifier.
Notes
  • For example:
  • lua</li><li>SetProp(foo):To("bar") -- will always set to "bar"</li><li>SetProp(modDate):To(os.time) -- will set to the current value returned by `os.time()` every time it's executed.</li><li>
ExamplesNone
Sourcesrc/extensions/cp/rx/go/SetProp.lua line 103