The STAB_GetElemByFloat function returns a string stored with a specific float value in a STAB object.
extern STAB_GetElemByFloat float handle // handle to STAB float searchval // search value stringvar strdata$ // string variable to receive matching string floatvar index // float variable to receive matching string's index
If handle is not a valid STAB handle, an error message will be printed to the console.
STAB_GetElemByFloat compares the value of searchval with each string's associated float value. It returns the first matching index, if one exists.
To perform a search that matches associated values rounded to the nearest integer, use STAB_GetElemByInt.
extern STAB_Create handle extern STAB_Append handle "a" 0.3 extern STAB_Append handle "b" 1.5 extern STAB_Append handle "c" 2.1 extern STAB_GetElemByInt handle 1.5 str$ idx
At the end of this code fragment, str$ will have a value of "b" and idx will have a value of 1.