Skip to content

CustomPropertyAccessor

Beta
Custom property accessor struct for accessing custom properties. You may want to cache the accessor for later usage in your script. However, when the cached custom property (or its parent property) is removed by another person, the accessor will be unusable

Functions

CustomPropertyType GetCustomPropertyType()Beta
Get the for the current entity.
boolean IsNull()Beta
Verify whether this custom property is (still) accessible. Use this API to check the item returned by a map or list.
number Count()Beta
Get count of items stored in the current custom property
String[] GetAllKeys()Beta
Get a list of strings that represent the keys for the current custom property (if it's a map type)
CustomPropertyAccessor GetItem(string key)Beta
Only available for map custom property. Returns an accessor for the specified key. Returns an accessor with being if the key does not exist.
CustomPropertyAccessor GetItem(number index)Beta
Only available for list custom property. Returns an accessor for the specified index. Returns an accessor with being if the key does not exist.
Only available for list custom property. Returns the first sub custom property in the list. Returns an accessor with being if the list is empty.
Only available for list custom property. Returns the last sub custom property in the list. Returns an accessor with being if the list is empty.
number GetNumber()Beta
Get number value from the custom property.
boolean GetBoolean()Beta
Get boolean value from the custom property.
string GetString()Beta
Get string value from the custom property.
string GetJson()Beta
Get json from the custom property (if the custom property is a map).
boolean AddOrUpdate(string key, number value)Beta
Only for map. Update the custom property for the specified key to the value. If no satisfied custom property is found in the map, a new custom property is created
boolean AddOrUpdate(string key, boolean value)Beta
Only for map. Update the custom property for the specified key to the value. If no satisfied custom property is found in the map, a new custom property is created
boolean AddOrUpdate(string key, string value)Beta
Only for map. Update the custom property for the specified key to the value. If no satisfied custom property is found in the map, a new custom property is created
CustomPropertyAccessor AddOrUpdateMap(string key)Beta
Only for map. Update the custom property for the specified key to an empty map. If no satisfied custom property is found in the map, a new custom property is created
CustomPropertyAccessor AddOrUpdateList(string key)Beta
Only for map. Update the custom property for the specified key to an empty list. If no satisfied custom property is found in the map, a new custom property is created
boolean Remove(string key)Beta
Only for map. Remove the custom property for the specified key.
void SetJson(string json)Beta
Only for map. Set the map content to the json equivalent nested custom property structure
  • json A json that only contains int/float (is converted to CustomPropertyType.Number), boolean (is converted to CustomPropertyType.Boolean), string (is converted to CustomPropertyType.String), object (is converted to CustomPropertyType.Map), and array (is converted to CustomPropertyType.List) types (null type is not supported)
void Append(number value)Beta
Only for list. Append the specified value to the end of the list.
void Append(boolean value)Beta
Only for list. Append the specified value to the end of the list.
void Append(string value)Beta
Only for list. Append the specified value to the end of the list.
CustomPropertyAccessor AppendList()Beta
Only for list. Append an empty list to the end of the list.
void AppendMap()Beta
Only for list. Append an empty map to the end of the list.
void Prepend(number value)Beta
Only for list. Insert the specified value at the start of the list.
void Prepend(boolean value)Beta
Only for list. Insert the specified value at the start of the list.
void Prepend(string value)Beta
Only for list. Insert the specified value at the start of the list.
void PrependList()Beta
Only for list. Insert an empty list at the start of the list.
void PrependMap()Beta
Only for list. Insert an empty map at the start of the list.
boolean SetAt(number index, number value)Beta
Only for list. Set the value at the specified index of the list.
boolean SetAt(number index, boolean value)Beta
Only for list. Set the value at the specified index of the list.
boolean SetAt(number index, string value)Beta
Only for list. Set the value at the specified index of the list.
CustomPropertyAccessor SetMapAt(number index)Beta
Only for list. Set an empty map at the specified index of the list.
CustomPropertyAccessor SetListAt(number index)Beta
Only for list. Set an empty list at the specified index of the list.
number Clip(number startIndex, number expectedCount)Beta
Only for list. Clip the list to the specified range, i.e., starting from the and counts as much as .
  • startIndex the start index must not be smaller than 0
  • expectedCount the expected count must not be smaller than 0
void Clear()Beta
Only applicable to map or list. Clear up the container.