Please wait while we load your page...


Latest Version [8.00202205221] Last Updated [May-22-2022]


PHP Manual [LuaSandbox

Protect Your Website Today

PHP Manual || LuaSandbox

(PECL luasandbox >= 1.2.0)

LuaSandbox::wrapPhpFunctionWrap a PHP callable in a LuaSandboxFunction


public 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().



Callable to wrap.

Return Values

Returns a LuaSandboxFunction.

See Also

PHP Manual || LuaSandbox