<?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 => 'uk',
  ),
  '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">Опис</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="para rdfs-comment">
   Calls a Lua function.
  </p>
  <p class="para">
   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="para">
   PHP and Lua types are converted as follows:
  </p>
  <p class="para">
   <ul class="itemizedlist">
    <li class="listitem">
     <p class="para">PHP <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> is Lua <code class="literal">nil</code>, and vice versa.</p>
    </li>
    <li class="listitem">
     <p class="para">
      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.
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      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.
     </p>
    </li>
    <li class="listitem">
     <p class="para">PHP <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span>s are Lua booleans, and vice versa.</p>
    </li>
    <li class="listitem">
     <p class="para">PHP <span class="type"><a href="language.types.string.php" class="type string">string</a></span>s are Lua strings, and vice versa.</p>
    </li>
    <li class="listitem">
     <p class="para">
      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.
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      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.
     </p>
     <p class="para">
      <ul class="itemizedlist">
       <li class="listitem">
        <p class="para">
         Note that Lua typically indexes arrays from 1, while PHP indexes
         arrays from 0. No adjustment is made for these differing
         conventions.
        </p>
       </li>
       <li class="listitem">
        <p class="para">Self-referential arrays are not supported in either direction.</p>
       </li>
       <li class="listitem">
        <p class="para">PHP references are dereferenced.</p>
       </li>
       <li class="listitem">
        <p class="para">
         Lua <code class="literal">__pairs</code> and <code class="literal">__ipairs</code> are processed.
         <code class="literal">__index</code> is ignored.
        </p>
       </li>
       <li class="listitem">
        <p class="para">
         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.
        </p>
       </li>
       <li class="listitem">
        <p class="para">
         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).
        </p>
       </li>
      </ul>
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      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.
     </p>
    </li>
   </ul>
  </p>
  <p class="para">
   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">Параметри</h3>
  <dl>
   
    <dt><code class="parameter">args</code></dt>
    <dd>
     <p class="para">
      Arguments passed to the function.
     </p>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-luasandboxfunction.call-returnvalues">
  <h3 class="title">Значення, що повертаються</h3>
  <p class="para">
   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,
    або <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> в разі помилки.
  </p>
 </div>


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