LuaSandbox::wrapPhpFunction
(PECL luasandbox >= 1.2.0)
LuaSandbox::wrapPhpFunction — Wrap a PHP callable in a LuaSandboxFunction
Description
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().
Parameters
function
Callable to wrap.
Return Values
Returns a LuaSandboxFunction.
See Also
- LuaSandbox::loadString() - Load Lua code into the Lua environment
- LuaSandbox::registerLibrary() - Register a set of PHP functions as a Lua library
来源:PHP Documentation Group · 作者与贡献记录 · CC BY 3.0。离线整理了版式、链接和媒体显示。
