« LuaSandbox::unpauseUsageTimer
LuaSandboxFunction »

LuaSandbox::wrapPhpFunction

(PECL luasandbox >= 1.2.0)

LuaSandbox::wrapPhpFunction — Wrap a PHP callable in a LuaSandboxFunction

説明

public function LuaSandbox::wrapPhpFunction(callable $function): LuaSandboxFunction

Wraps a PHP callable in a LuaSandboxFunction, so it can be passed into Lua as an anonymous function.

The function must return either an array of values (which may be empty), or null which is equivalent to returning the empty array.

Exceptions will be raised as errors in Lua, however only LuaSandboxRuntimeError exceptions may be caught inside Lua with pcall() or xpcall().

For more information about calling Lua functions and the return values, see LuaSandboxFunction::call().

パラメータ

function

Callable to wrap.

戻り値

Returns a LuaSandboxFunction.

参考

関連キーワード:
LuaSandboxFunction   LuaSandbox   callable   wrapPhpFunction   empty   functions   unpauseUsageTimer   luasandbox   passed   anonymous   Exceptions   errors   LuaSandboxRuntimeError   exceptions   pcall   xpcall   call   Callable   loadString   Load   code   environment   registerLibrary   Register   library
関連する関数・ページ:
class.luasandboxfunction   luasandboxfunction.construct   luasandbox.loadbinary   luasandbox.loadstring   book.luasandbox   luasandbox.registerlibrary

他のマニュアルの関連ページ