Angelscript/docs/manual/group__api__principal__func...

207 lines
13 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.18"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>AngelScript: Principal functions</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function() { init_search(); });
/* @license-end */
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="aslogo_small.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">AngelScript
</div>
</td>
<td> <div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.18 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('group__api__principal__functions.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">Principal functions</div> </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:gacb6a62345d9cca6c9b5a3dac67d80d0b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="angelscript_8h.html#a6412a04ba6b2737922fdb2d8f822f51c">AS_API</a> <a class="el" href="classas_i_script_engine.html">asIScriptEngine</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__api__principal__functions.html#gacb6a62345d9cca6c9b5a3dac67d80d0b">asCreateScriptEngine</a> (<a class="el" href="angelscript_8h.html#a5428f0c940201e5f3bbb28304aeb81bc">asDWORD</a> version=<a class="el" href="angelscript_8h.html#a99c6b8b0882e45e5d0b2ed19f6f7a157">ANGELSCRIPT_VERSION</a>)</td></tr>
<tr class="memdesc:gacb6a62345d9cca6c9b5a3dac67d80d0b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates the script engine. <a href="group__api__principal__functions.html#gacb6a62345d9cca6c9b5a3dac67d80d0b">More...</a><br /></td></tr>
<tr class="separator:gacb6a62345d9cca6c9b5a3dac67d80d0b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad3a20dc58093b92a5a44c7b6ada34a10"><td class="memItemLeft" align="right" valign="top"><a class="el" href="angelscript_8h.html#a6412a04ba6b2737922fdb2d8f822f51c">AS_API</a> <a class="el" href="classas_i_script_context.html">asIScriptContext</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__api__principal__functions.html#gad3a20dc58093b92a5a44c7b6ada34a10">asGetActiveContext</a> ()</td></tr>
<tr class="memdesc:gad3a20dc58093b92a5a44c7b6ada34a10"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the currently active context. <a href="group__api__principal__functions.html#gad3a20dc58093b92a5a44c7b6ada34a10">More...</a><br /></td></tr>
<tr class="separator:gad3a20dc58093b92a5a44c7b6ada34a10"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga863f2a1e60e6c19eea9c6b34690dcc00"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr>
<tr class="memitem:ga863f2a1e60e6c19eea9c6b34690dcc00"><td class="memTemplItemLeft" align="right" valign="top"><a class="el" href="angelscript_8h.html#ac8186f029686800b7ce36bde4a55c815">asUINT</a>&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="group__api__principal__functions.html#ga863f2a1e60e6c19eea9c6b34690dcc00">asGetTypeTraits</a> ()</td></tr>
<tr class="memdesc:ga863f2a1e60e6c19eea9c6b34690dcc00"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the appropriate flags for use with RegisterObjectType. <a href="group__api__principal__functions.html#ga863f2a1e60e6c19eea9c6b34690dcc00">More...</a><br /></td></tr>
<tr class="separator:ga863f2a1e60e6c19eea9c6b34690dcc00"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<h2 class="groupheader">Function Documentation</h2>
<a id="gacb6a62345d9cca6c9b5a3dac67d80d0b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gacb6a62345d9cca6c9b5a3dac67d80d0b">&#9670;&nbsp;</a></span>asCreateScriptEngine()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="angelscript_8h.html#a6412a04ba6b2737922fdb2d8f822f51c">AS_API</a> <a class="el" href="classas_i_script_engine.html">asIScriptEngine</a>* asCreateScriptEngine </td>
<td>(</td>
<td class="paramtype"><a class="el" href="angelscript_8h.html#a5428f0c940201e5f3bbb28304aeb81bc">asDWORD</a>&#160;</td>
<td class="paramname"><em>version</em> = <code><a class="el" href="angelscript_8h.html#a99c6b8b0882e45e5d0b2ed19f6f7a157">ANGELSCRIPT_VERSION</a></code></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">version</td><td>The library version. Should always be <a class="el" href="angelscript_8h.html#a99c6b8b0882e45e5d0b2ed19f6f7a157">ANGELSCRIPT_VERSION</a>. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A pointer to the script engine interface, or null on error.</dd></dl>
<p>Call this function to create a new script engine. When you're done with the script engine, i.e. after you've executed all your scripts, you should call <a class="el" href="classas_i_script_engine.html#a28c3800620d4aeaca75d084391eb758e">ShutDownAndRelease</a> on the pointer to cleanup any objects that may still be alive and free the engine object.</p>
<p>The <em>version</em> argument is there to allow AngelScript to validate that the application has been compiled with the correct interface. This is especially important when linking dynamically against the library. If the version is incorrect a null pointer is returned. </p>
</div>
</div>
<a id="gad3a20dc58093b92a5a44c7b6ada34a10"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gad3a20dc58093b92a5a44c7b6ada34a10">&#9670;&nbsp;</a></span>asGetActiveContext()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="angelscript_8h.html#a6412a04ba6b2737922fdb2d8f822f51c">AS_API</a> <a class="el" href="classas_i_script_context.html">asIScriptContext</a>* asGetActiveContext </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<dl class="section return"><dt>Returns</dt><dd>A pointer to the currently executing context, or null if no context is executing.</dd></dl>
<p>This function is most useful for registered functions, as it will allow them to obtain a pointer to the context that is calling the function, and through that get the engine, or custom user data.</p>
<p>If the script library is compiled with multithread support, this function will return the context that is currently active in the thread that is being executed. It will thus work even if there are multiple threads executing scripts at the same time.</p>
<p>This function does not increase the reference count of the context. </p>
</div>
</div>
<a id="ga863f2a1e60e6c19eea9c6b34690dcc00"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga863f2a1e60e6c19eea9c6b34690dcc00">&#9670;&nbsp;</a></span>asGetTypeTraits()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T &gt; </div>
<table class="memname">
<tr>
<td class="memname"><a class="el" href="angelscript_8h.html#ac8186f029686800b7ce36bde4a55c815">asUINT</a> asGetTypeTraits </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<dl class="tparams"><dt>Template Parameters</dt><dd>
<table class="tparams">
<tr><td class="paramname">T</td><td>The type for which the flags should be determined </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The flags necessary to register this type as a value type</dd></dl>
<dl class="section note"><dt>Note</dt><dd>This function is only availabe if the compiler supports C++11 feature set. Check existance with #if <a class="el" href="angelscript_8h.html#a9e0eb27a2013e875a33565dd3fe76f79">AS_CAN_USE_CPP11</a>.</dd></dl>
<p>This template function uses C++11 STL template functions to determine the appropriate flags to use when registering the desired type as a value type with <a class="el" href="classas_i_script_engine.html#a29c6c087c8c5b5cdb6271cfd161cc5a6">asIScriptEngine::RegisterObjectType</a>.</p>
<p>It is capable to determine all the <a class="el" href="angelscript_8h.html#a855d86fa9ee15b9f75e553ee376b5c7a">asOBJ_APP_xxx</a> flags, except for <a class="el" href="angelscript_8h.html#a855d86fa9ee15b9f75e553ee376b5c7aa5b8de58c5be3145aaa3e54008fb2edeb">asOBJ_APP_CLASS_ALLINTS</a>, <a class="el" href="angelscript_8h.html#a855d86fa9ee15b9f75e553ee376b5c7aa12afb6a0fa4ac874ce89815d3611823d">asOBJ_APP_CLASS_ALLFLOATS</a>, and <a class="el" href="angelscript_8h.html#a855d86fa9ee15b9f75e553ee376b5c7aa244efb813b401b3a6d087c3add802818">asOBJ_APP_CLASS_ALIGN8</a>. These flags must still be informed manually when needed.</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="doc_register_val_type.html#doc_reg_val_2">Value types and native calling conventions</a> </dd></dl>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">Generated on Sat Dec 5 2020 23:20:25 for AngelScript by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.18 </li>
</ul>
</div>
</body>
</html>