<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<script type="text/javascript" language="JavaScript">
function reDo() {
if (innerWidth != origWidth || innerHeight != origHeight)
location.reload();
}
if ((parseInt(navigator.appVersion) == 4) && (navigator.appName == "Netscape")) {
origWidth = innerWidth;
origHeight = innerHeight;
onresize = reDo;
}
onerror = null;
</script>
<style type="text/css">
< !-- div.WebHelpPopupMenu {
position: absolute;
left: 0px;
top: 0px;
z-index: 4;
visibility: hidden;
}
p.WebHelpNavBar {
text-align: right;
}
-->
</style>
<script type="text/javascript">
gRootRelPath = "../../..";
gCommonRootRelPath = "../../..";
gTopicId = "9.2.8.6_1";
<script type="text/javascript" src="../../../template/scripts/rh.min.js"></script>
<script type="text/javascript" src="../../../template/scripts/common.min.js"></script>
<script type="text/javascript" src="../../../template/scripts/topic.min.js"></script>
<script type="text/javascript" src="../../../template/scripts/topicwidgets.min.js"></script>
<script type="text/javascript" src="../../../whxdata/projectsettings.js"></script>
<link rel="stylesheet" type="text/css" href="../../../template/styles/topic.min.css"/>
<link rel="stylesheet" type="text/css" href="../../../template/Charcoal_Grey/topicheader.css"/>
<meta name="topic-status" content="Draft"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>ds_exists</title>
<meta name="generator" content="Adobe RoboHelp 2019"/>
<link rel="stylesheet" href="../../../assets/css/default.css" type="text/css"/>
<meta name="rh-authors" content="Mark Alexander"/>
<meta name="topic-comment" content="Reference page for ds_exists"/>
<meta name="rh-index-keywords" content="ds_exists,ds_type_priority,ds_type_queue,ds_type_grid,ds_type_stack,ds_type_list,ds_type_map"/>
<meta name="search-keywords" content="ds_exists,ds_type_priority,ds_type_queue,ds_type_grid,ds_type_stack,ds_type_list,ds_type_map"/>
</head>
<body>
<div class="topic-header rh-hide" id="rh-topic-header" onclick="rh._.goToFullLayout()">
<div class="logo">
</div>
<div class="nav">
<div class="title" title="ds_exists">
<span>ds_exists</span>
</div>
<div class="gotohome" title="Click here to see this page in full context">
<span>Click here to see this page in full context</span>
</div>
</div>
</div>
<div class="topic-header-shadow rh-hide" id="rh-topic-header-shadow"></div>
<h1>ds_exists</h1>
<p>With this function you can check to see if a data structure of the given type exists. You supply the "index" value (as held in a variable) and the DS "type", which can be any of the constants listed below, and the function will return <tt>true</tt> if
the data structure exists and <tt>false</tt> otherwise.</p>
<p> </p>
<table>
<tbody>
<tr>
<th>Constant</th>
<th>Description</th>
</tr>
<tr>
<td>ds_type_map</td>
<td>A <a href="DS_Maps/DS_Maps.htm">map</a> data structure</td>
</tr>
<tr>
<td>ds_type_list</td>
<td>A <a href="DS_Lists/DS_Lists.htm">list</a> data structure</td>
</tr>
<tr>
<td>ds_type_stack</td>
<td>A <a href="DS_Stacks/DS_Stacks.htm">stack</a> data structure</td>
</tr>
<tr>
<td>ds_type_grid</td>
<td>A <a href="DS_Grids/DS_Grids.htm">grid</a> data structure</td>
</tr>
<tr>
<td>ds_type_queue</td>
<td>A <a href="DS_Queues/DS_Queues.htm">queue</a> data structure</td>
</tr>
<tr>
<td>ds_type_priority</td>
<td>A <a href="DS_Priority_Queues/DS_Priority_Queues.htm">priority</a> data structure</td>
</tr>
</tbody>
</table>
<p> </p>
<p> </p>
<h4>Syntax:</h4>
<p class="code">ds_exists(ind, type);</p>
<table>
<tbody>
<tr>
<th>Argument</th>
<th>Description</th>
</tr>
<tr>
<td>ind</td>
<td>The variable index to check for the data structure</td>
</tr>
<tr>
<td>type</td>
<td>The type of data structure to check for (see the list of constants below)</td>
</tr>
</tbody>
</table>
<p> </p>
<h4>Returns:</h4>
<p class="code">Boolean</p>
<p> </p>
<h4>Example:</h4>
<p class="code">if !ds_exists(ai_grid, ds_type_grid)<br/> {
<br/> ai_grid = ds_grid_create(room_width / 32, room_height / 32);<br/> }
</p>
<p>The above code checks the (previously initialised) variable "ai_grid" to see if it indexes a DS grid type data structure, and if it does not then it creates one and stores its index in the variable.</p>
<p> </p>
<p> </p>
<p> </p>
<div class="footer">
<div class="buttons">
<div class="clear">
<div style="float:left">Back: <a href="Data_Structures.htm">Data Structures</a></div>
<div style="float:right">Next: <a href="ds_set_precision.htm">ds_set_precision</a></div>
</div>
</div>
<h5>© Copyright YoYo Games Ltd. 2020 All Rights Reserved</h5>
</div>
</body></html>