LuaSandbox
extension to run Lua 5.1 code from PHP
|
Represents a Lua function, allowing it to be called from PHP. More...
Public Member Functions | |
call () | |
Call a Lua function. | |
dump () | |
Dump the function as a binary blob. | |
Represents a Lua function, allowing it to be called from PHP.
A LuaSandboxFunction may be obtained as a return value from Lua, as a parameter passed to a callback from Lua, or by using LuaSandbox::wrapPhpFunction(), LuaSandbox::loadString(), or LuaSandbox::loadBinary().
LuaSandboxFunction::call | ( | ) |
Call a Lua function.
Errors considered to be the fault of the PHP code will result in the function returning false and E_WARNING being raised, for example, a resource type being used as an argument. Lua errors will result in a LuaSandboxRuntimeError exception being thrown.
PHP and Lua types are converted as follows:
__pairs
and __ipairs
are processed. __index
is ignored.$a[0]
and $a["0"]
as being equivalent).Lua functions inherently return a list of results. So on success, this method returns an array containing all of the values returned by Lua, with integer keys starting from zero. Lua may return no results, in which case an empty array is returned.
mixed | $args,... | Arguments passed to the function. |
LuaSandboxFunction::dump | ( | ) |
Dump the function as a binary blob.