Lua::include
LuaClosure
Lua
PHP Manual

# Lua::registerCallback

(No version information available, might only be in SVN)

Lua::registerCallback — Register a PHP function to Lua

### Beschreibung

public mixed Lua::registerCallback ( string `$name` , callable `$function` )

Register a PHP function to Lua as a function named "$name"

### Parameter-Liste

`name`

`function`

  A valid PHP function callback

### Rückgabewerte

Returns $this, `NULL` for wrong arguments or `FALSE` on other failure.

### Beispiele

Beispiel #1 Lua::registerCallback()example

`<?php
$lua = new Lua();
$lua->registerCallback("echo", "var_dump");
$lua->eval(<<<CODE
echo({1, 2, 3});
CODE
);
?>`

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

    array(3) {
      [1]=>
      float(1)
      [2]=>
      float(2)
      [3]=>
      float(3)
    }

Lua::include
LuaClosure
Lua
PHP Manual