略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: Lua::call

2024-05-01

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"

参见

add a noteadd a note

User Contributed Notes

There are no user contributed notes for this page.

官方地址:https://www.php.net/manual/en/lua.call.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3