Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Lookup allows you to find an element which matches (or is close) an argument you pass to the lookup function. This API will return the index of the value if it has found a match, otherwise it will return 0.

Parameters
  1. the array object to search in
  2. index to start the search from (can pass null, which defaults to 1)
  3. value to search forSearch argument
  4. Array
  5. Start index (OR resulting indicators object)
  6. Resulting indicators (can be null)
  7. Search type - "LE", "LT". "GE", "GT". Can be null.

...

Code Block
languagejavascript
  pjs.define("iSRCHWD", { type: 'integerpacked decimal', length: 32, decimals: 0 });
  pjs.define("SRCHWDarr", { 
    type: 'charpacked decimal',
    length: 2,
15 }); pjs.define("arr", { typedecimals: 'char'0,
length    dim: 1520,
   dim orderby: 10'ASCEND' 
  });

  arr[1] = 'Cornwall'12;
  arr[2] = 'kingston'23;
  arr[3] = 'London'54;
  arr[4] = 'Paris'57;
  arr[5] = 'Scarborough'89;
  arr[6] = 'York'63;
  arr[7] = 'Columbus'29;
  arr[8] = 'Dayton'26;
  arr[9] = 'centerville'73;
  arr[10] = 'vasad'50;

  SRCHWD = 'York'44;

i = pjs.lookuplookupLE(SRCHWD, arr, { low: null80, SRCHWDequal: 81 });

  if //i = 6 

...

(flags[80] && !flags[81]) {
    //console.log(var1.trim());
  }


RPG Equivalent

%LOOKUP(), LOOKUP