php8.5
Home/ Manual/ lua / luaclosure/ LuaClosure::__invoke

LuaClosure::__invoke

PHP function Edit on GitHub ✎

(PECL lua >=0.9.0)

Invoke luaclosure

Description

LuaClosure::__invoke(mixed ...$args): void

Func

Parameters

args

Return Values

Examples

LuaClosure::__invoke()example

php
<?php
$lua = new Lua();
$closure = $lua->eval(<<<CODE
    return (function ()
        print("hello world")
    end)
CODE
);

$lua->call($closure);
$closure();
?>

The above example will output:

output
hello worldhello world

Source: reference/lua/luaclosure/invoke.xml · from the official PHP manual (php/doc-en)