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
- Argument - Value searching for
- Index - start from this index
- Element Count - for this many elements
- 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