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=>12=>23=>3), "-")));
?>

以上例程會輸出:

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

參見