get index of the previous existing array element
tag - tag of array (AR_LONG or AR_STR)
id - array id
idx - index of the current element
returns: -1 - no more array elements
otherwise returns index of the previous array element
long get_prev_index(long tag, long id, long idx);