• PHP Video Tutorials

PHP - Lua::call() __call()



Lua::call -- Lua::__call — Call Lua functions

Syntax

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

Lua::call -- Lua::__call function can return the result of a called function, NULL for wrong arguments or false on failure.

Example

<?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), "-")));
?>
php_function_reference.htm
Advertisements