anachronox-sdk/docs/stab/stab_getelem.bak
2002-01-21 00:00:00 +00:00

64 lines
2.2 KiB
Text

<html>
<head>
<title>STAB_GetElem</title>
<meta name="Author" content="Joey">
<link rel="stylesheet" type="text/css" href="../webdocs.css">
</head>
<body>
<h1><a name="ape_stab_getelem"></a>STAB_GetElem</h3>
<p>The <b>STAB_GetElem</b> function returns a string stored
at a specific index in a STAB object.</p>
<PRE class="syntax"><b>extern STAB_GetElem</b>
<b> float</b><i> handle</i> // handle to STAB
<b> float</b><i> index</i> // index to data
<b> stringvar</b><i> strdata$</i> // string variable to receive string
<b> floatvar</b><i> fltdata</i> // (optional) float variable to receive associated data
</PRE>
<h4>Parameters</h4>
<dl>
<dt><i>handle</i></dt>
<dd>[in] Handle to a STAB object previously returned from
<a href="stab_create.html"><b>STAB_Create</b></a>.
</dd>
<dt><i>index</i></dt>
<dd>[in] The zero-based index of the string to retrieve.</dd>
<dt><i>strdata$</i></dt>
<dd>[out] The string variable that will be set with the string
stored in the STAB object specified by <i>handle</i> and <i>index</i>.</dd>
<dt><i>fltdata</i></dt>
<dd>[out] The float variable that will be set with the optional
data associated with the string when it was added to the STAB object.</dd>
</dl>
<h4>Remarks</h4>
<p>If <i>handle</i> is not a valid STAB handle, an error message will
be printed to the console. If <i>index</i> is not at least zero and
strictly less than the value returned from
<a href="stab_getsize.html"><b>STAB_GetSize</b></a>, an error message
will be printed to the console. For example, if the array size
is 10, then the possible values of <i>index</i> is between 0 and 9.
</p>
<p>If there was no optional float value specified when the
string was added to the STAB object, <i>fltdata</i> will
have a value of zero.</p>
<h4>Example</h4>
<p>The following code fragment demonstrates how to use a loop to retrieve
every element in a STAB object.
<pre>// Assume @handle is already initialized to
// a STAB object with data in it.
extern STAB_GetSize @handle @size
@i = 0
while (@i < @size)
{
STAB_GetElem @handle @i @str$
// Do something useful with the string.
}</pre>
</body>
</html>