getpropname( variable, offset )


Parameters

  Type Description
variable rvalue variable to examine
offset numberic index of property

_result

Set to a string value that is a property name.

Descriptions

Sets _result to the name of the property on variable at the index specified by offset. This command is used to discover the property names on a variable. The value specified by offset must be greater than or equal to zero and less than the total number of properties as returned by countprops. When a property is added to or removed from a variable, the indexes of all properties may change. To avoid errors, the index to property name mapping should not be saved.

The getpropname command is useful when examining radio messages with an unknown format. After a property value's name has been found it can be used in the array notation to retrieve the property's value. In the example below, the user variable var is examined for properties. First, the number of properties is obtained by calling countprops. Then a while loop is used to retrieve the name and value of each property and send it to the print log. In this example, the value of the properties is obtained by using the property names in the array notation like this: var[_result]

countprops( var )
count = _result

i = 0
while( i < count )
    getpropname( var, i );
    print( "var." + _result + " == " + var[_result] );
    i = i + 1
endw


For more information about properties see the user variables topic.

See Also

countprops, clearprops, hasprop, countarray, cleararray, setarraycount, assignment (=), copy, initialize, clear, isequal, user variables