Difference between revisions of "Getelementofarray"

From Hercules Wiki
Jump to: navigation, search
(Created page with "==Syntax== *'''getelementofarray'''(<array variable>, <index>); ==Description== This command retrieves the value of the element of given array at given index. This is equival...")
 

Latest revision as of 19:43, 13 January 2013

Syntax

  • getelementofarray(<array variable>, <index>);

Description

This command retrieves the value of the element of given array at given index. This is equivalent to using:

array[index]

The reason for this is, that this short form is internally converted into a call to getelementofarray, when the script is loaded.

Examples

setarray @array[0], 1, 2, 3;
set @varl, getelementofarray(@array, 2);  // retrieves 3
set @vars, @array[2];  // retrieves 3 as well

if(@varl!=@vars)
{
    mes "This will never be shown";
}