1
0
mirror of https://github.com/php/doc-en.git synced 2026-03-23 23:32:18 +01:00
Files
archived-doc-en/reference/lua/lua/registercallback.xml

105 lines
2.3 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="lua.registercallback">
<refnamediv>
<refname>Lua::registerCallback</refname>
<refpurpose>Register a PHP function to Lua</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>mixed</type><methodname>Lua::registerCallback</methodname>
<methodparam><type>string</type><parameter>name</parameter></methodparam>
<methodparam><type>callable</type><parameter>function</parameter></methodparam>
</methodsynopsis>
<simpara>
Register a PHP function to Lua as a function named "$name"
</simpara>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>name</parameter></term>
<listitem>
<simpara>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>function</parameter></term>
<listitem>
<simpara>
A valid PHP function callback
</simpara>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<simpara>
Returns <varname>$this</varname>, &null; for wrong arguments or &false; on
other failure.
</simpara>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>Lua::registerCallback</function>example</title>
<programlisting role="php">
<![CDATA[
<?php
$lua = new Lua();
$lua->registerCallback("echo", "var_dump");
$lua->eval(<<<CODE
echo({1, 2, 3});
CODE
);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
array(3) {
[1]=>
float(1)
[2]=>
float(2)
[3]=>
float(3)
}
]]>
</screen>
</example>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->