Lua::call

Lua::__call

(PECL lua >=0.9.0)

Lua::call -- Lua::__call調(diào)用Lua函數(shù)

說明

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

警告

本函數(shù)還未編寫文檔,僅有參數(shù)列表。

參數(shù)

lua_func

lua中的函數(shù)名。

args

向Lua函數(shù)傳入的參數(shù)。

use_self

是否使用self。

返回值

返回調(diào)用函數(shù)的結(jié)果,參數(shù)錯誤返回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"

參見