Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

The lookup function provides the functionality to look for a certain element in an array (and data-structure array) which is less than the argument provided.

Parameters
  1. Argument - Value searching for
  2. Index - start from this index
  3. Element Count - for this many elements
  4. Subfield - if searching in a data-structure array, which subfield should the function look up. Can be null.
Return Value

Function will return 0 if no matching element has been found, otherwise it will return the element index.

Example
  pjs.define("NumIndex", { type: 'unsigned integer', length: 3, decimals: 0 });
  pjs.define("arr", { type: 'char', length: 1, dim: 10, orderby: 'ASCEND' });

  arr[1] = 'A';
  arr[2] = 'C';
  arr[3] = 'C';
  arr[4] = 'C';
  arr[5] = 'E';
  arr[6] = 'E';
  arr[7] = 'G';
  arr[8] = 'L';
  arr[9] = 'J';
  arr[10] = 'V';

  NumIndex = arr.lookupLE('D', 1, 10);

RPG Equivalent

%LOOKUPLT

  • No labels