Lua::registerCallback
(No version information available, might only be in Git)
Lua::registerCallback — Register a PHP function to Lua
Description
public mixed Lua::registerCallback ( string $name , callable $function )
Register a PHP function to Lua as a function named "$name"
Parameters
name
function
A valid PHP function callback
Return Values
Returns $this, NULL
for wrong arguments or FALSE
on other failure.
Examples
Example #1 Lua::registerCallback()example
<?php
$lua = new Lua();
$lua->registerCallback("echo", "var_dump");
$lua->eval(<<<CODE
echo({1, 2, 3});
CODE
);
?>
The above example will output:
array(3) {
[1]=>
float(1)
[2]=>
float(2)
[3]=>
float(3)
}
← Lua::include
LuaClosure →
© 1997–2017 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com