<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.luasandboxfunction.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'luasandboxfunction.call.php',
    1 => 'LuaSandboxFunction::call',
    2 => 'Call a Lua function',
  ),
  'up' => 
  array (
    0 => 'class.luasandboxfunction.php',
    1 => 'LuaSandboxFunction',
  ),
  'prev' => 
  array (
    0 => 'class.luasandboxfunction.php',
    1 => 'LuaSandboxFunction',
  ),
  'next' => 
  array (
    0 => 'luasandboxfunction.construct.php',
    1 => 'LuaSandboxFunction::__construct',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/luasandbox/luasandboxfunction/call.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="luasandboxfunction.call" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">LuaSandboxFunction::call</h1>
  <p class="verinfo">(PECL luasandbox &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">LuaSandboxFunction::call</span> &mdash; <span class="dc-title">Call a Lua function</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-luasandboxfunction.call-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>LuaSandboxFunction::call</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">...$args</code></span>): <span class="type"><span class="type"><a href="language.types.array.php" class="type array">array</a></span>|<span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></span></div>

  <p class="simpara">
   Calls a Lua function.
  </p>
  <p class="simpara">
   Errors considered to be the fault of the PHP code will result in the
   function returning <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> and <strong><code><a href="errorfunc.constants.php#constant.e-warning">E_WARNING</a></code></strong>
   being raised, for example, a <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> type being used as an
   argument. Lua errors will result in a <span class="classname"><a href="class.luasandboxruntimeerror.php" class="classname">LuaSandboxRuntimeError</a></span>
   exception being thrown.
  </p>
  <p class="simpara">
   PHP and Lua types are converted as follows:
  </p>
  <ul class="itemizedlist">
   <li class="listitem">
    <span class="simpara">PHP <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> is Lua <code class="literal">nil</code>, and vice versa.</span>
   </li>
   <li class="listitem">
    <span class="simpara">
     PHP <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>s and <span class="type"><a href="language.types.float.php" class="type float">float</a></span>s are converted to Lua
     numbers. Infinity and <strong><code><a href="math.constants.php#constant.nan">NAN</a></code></strong> are supported.
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
     Lua numbers without a fractional part between approximately <code class="literal">-2**53</code>
     and <code class="literal">2**53</code> are converted to PHP <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>s, with others
     being converted to PHP <span class="type"><a href="language.types.float.php" class="type float">float</a></span>s.
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">PHP <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span>s are Lua booleans, and vice versa.</span>
   </li>
   <li class="listitem">
    <span class="simpara">PHP <span class="type"><a href="language.types.string.php" class="type string">string</a></span>s are Lua strings, and vice versa.</span>
   </li>
   <li class="listitem">
    <span class="simpara">
     Lua functions are PHP <span class="classname"><a href="class.luasandboxfunction.php" class="classname">LuaSandboxFunction</a></span> objects, and vice versa.
     General PHP <span class="type"><a href="language.types.callable.php" class="type callable">callable</a></span>s are not supported.
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
     PHP <span class="type"><a href="language.types.array.php" class="type array">array</a></span>s are converted to Lua tables, and vice versa.
    </span>
    <ul class="itemizedlist">
     <li class="listitem">
      <span class="simpara">
       Note that Lua typically indexes arrays from 1, while PHP indexes
       arrays from 0. No adjustment is made for these differing
       conventions.
      </span>
     </li>
     <li class="listitem">
      <span class="simpara">Self-referential arrays are not supported in either direction.</span>
     </li>
     <li class="listitem">
      <span class="simpara">PHP references are dereferenced.</span>
     </li>
     <li class="listitem">
      <span class="simpara">
       Lua <code class="literal">__pairs</code> and <code class="literal">__ipairs</code> are processed.
       <code class="literal">__index</code> is ignored.
      </span>
     </li>
     <li class="listitem">
      <span class="simpara">
       When converting from PHP to Lua, integer keys between
       <code class="literal">-2**53</code> and <code class="literal">2**53</code> are represented
       as Lua numbers. All other keys are represented as Lua strings.
      </span>
     </li>
     <li class="listitem">
      <span class="simpara">
       When converting from Lua to PHP, keys other than strings and
       numbers will result in an error, as will collisions when converting
       numbers to strings or vice versa (since PHP considers things like
       <code class="literal">$a[0]</code> and <code class="literal">$a[&quot;0&quot;]</code> as being equivalent).
      </span>
     </li>
    </ul>
   </li>
   <li class="listitem">
    <span class="simpara">
     All other types are unsupported and will raise an error/exception,
     including general PHP <span class="type"><a href="language.types.object.php" class="type object">object</a></span>s and Lua userdata and thread types.
    </span>
   </li>
  </ul>
  <p class="simpara">
   Lua functions inherently return a list of results. So on success, this
   method returns an <span class="type"><a href="language.types.array.php" class="type array">array</a></span> containing all of the values returned by Lua,
   with <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> keys starting from zero. Lua may return no results, in
   which case an empty array is returned.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-luasandboxfunction.call-parameters">
  <h3 class="title">Parameter-Liste</h3>
  <dl>
   
    <dt><code class="parameter">args</code></dt>
    <dd>
     <span class="simpara">
      Arguments passed to the function.
     </span>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-luasandboxfunction.call-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="simpara">
   Returns an <span class="type"><a href="language.types.array.php" class="type array">array</a></span> of values returned by the function, which may be empty,
   Bei einem Fehler wird <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> zurückgegeben..
  </p>
 </div>


</div><?php manual_footer($setup); ?>