Getelementofarray

From Hercules Wiki
Revision as of 19:43, 13 January 2013 by Nameless2you (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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";
}