CakeFest 2024: The Official CakePHP Conference

Lua::call

Lua::__call

(PECL lua >=0.9.0)

Lua::call -- Lua::__call调用Lua函数

说明

public Lua::call(callable $lua_func, array $args = ?, int $use_self = 0): mixed
public Lua::__call(callable $lua_func, array $args = ?, int $use_self = 0): mixed

警告

本函数还未编写文档,仅有参数列表。

参数

lua_func

lua中的函数名。

args

向Lua函数传入的参数。

use_self

是否使用self

返回值

返回调用函数的结果,参数错误返回null ,其它错误返回false

示例

示例 #1 Lua::call()示例

<?php
$lua
= new Lua();
$lua->eval(<<<CODE
function dummy(foo, bar)
print(foo, ",", bar)
end
CODE
);
$lua->call("dummy", array("Lua", "geiliable\n"));
$lua->dummy("Lua", "geiliable"); // __call()
var_dump($lua->call(array("table", "concat"), array(array(1=>1, 2=>2, 3=>3), "-")));
?>

以上示例会输出:

Lua,geiliable
Lua,geiliable
string(5) "1-2-3"

参见

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top