Get val Spell method

From SDU
Jump to: navigation, search
To make corrections or additions to this article, select the edit tab above.
To discuss or ask questions about this article, select the discussion tab above.

Overview

This method gets value of some single (not REL) attribute and returns it. It also preserves datatype of column. It is suitable for accessing attributes with reserved name (bool, function, class...), n-th item of multivalue (group.member_list.0.combo_name) or dynamic reading, where attribute name is in variable.

This action can be called in spell code in method send_wait for call_attr.

Usage

<source lang="javascript"> void send_wait (int timeout, object top_object, "call_attr", string attr_name, "get_val") </source>

  • timeout - how long (?in seconds?) should the method wait for finishing the method (0 means infinite)
  • top_object - object where the attribute is placed
  • attr_name - name of attribute which value should be get

Results

On success attribute value is in the first position of global array msg. <source lang="javascript"> retval = msg[0]; </source>

Examples

<source lang="javascript"> // Part of code to read group members for( iLoop = 0; iLoop < member_count; iLoop++ ) {

   send_wait(0, some_group, "call_attr", format("member_list.%d.combo_name",iLoop), "get_val");
   if (msg_error()) {
       logf(ERROR, "%s: error in get_val: %s", method, msg[0]);
       continue;
   }
   member_name = msg[0];
   ....

} </source>