MediaWiki REL1_34
Scribunto_LuaInterpreter Class Reference
Inheritance diagram for Scribunto_LuaInterpreter:

Public Member Functions

 callFunction ( $func,... $args)
 Call a Lua function.
 
 isLuaFunction ( $object)
 Test whether an object is a Lua function.
 
 loadString ( $text, $chunkName)
 Load a string.
 
 pauseUsageTimer ()
 Pause CPU usage and limits.
 
 registerLibrary ( $name, array $functions)
 Register a library of functions.
 
 unpauseUsageTimer ()
 Unpause CPU usage and limits.
 
 wrapPhpFunction ( $callable)
 Wrap a PHP callable as a Lua function, which can be passed back into Lua.
 

Detailed Description

Definition at line 3 of file LuaInterpreter.php.

Member Function Documentation

◆ callFunction()

Scribunto_LuaInterpreter::callFunction ( $func,
$args )
abstract

Call a Lua function.

Return an array of results, with indices starting at zero. If an error occurs, a Scribunto_LuaError will be thrown.

Parameters
mixed$funcThe function object
mixed...$args Arguments to the function

Reimplemented in Scribunto_LuaSandboxInterpreter, and Scribunto_LuaStandaloneInterpreter.

◆ isLuaFunction()

Scribunto_LuaInterpreter::isLuaFunction ( $object)
abstract

Test whether an object is a Lua function.

Parameters
object$object
Returns
bool

Reimplemented in Scribunto_LuaSandboxInterpreter, and Scribunto_LuaStandaloneInterpreter.

◆ loadString()

Scribunto_LuaInterpreter::loadString ( $text,
$chunkName )
abstract

Load a string.

Return an object which can later be passed to callFunction. If there is a pass error, a Scribunto_LuaError will be thrown.

Parameters
string$textThe Lua source code
string$chunkNameThe chunk name
Returns
mixed

Reimplemented in Scribunto_LuaSandboxInterpreter, and Scribunto_LuaStandaloneInterpreter.

◆ pauseUsageTimer()

Scribunto_LuaInterpreter::pauseUsageTimer ( )
abstract

Pause CPU usage and limits.

Returns
void

Reimplemented in Scribunto_LuaSandboxInterpreter, and Scribunto_LuaStandaloneInterpreter.

◆ registerLibrary()

Scribunto_LuaInterpreter::registerLibrary ( $name,
array $functions )
abstract

Register a library of functions.

Parameters
string$nameThe global variable name to be created or added to.
array$functionsAn associative array mapping the function name to the callback. The callback may throw a Scribunto_LuaError, which will be caught and raised in the Lua code as a Lua error, catchable with pcall().

Reimplemented in Scribunto_LuaSandboxInterpreter, and Scribunto_LuaStandaloneInterpreter.

◆ unpauseUsageTimer()

Scribunto_LuaInterpreter::unpauseUsageTimer ( )
abstract

Unpause CPU usage and limits.

Returns
void

Reimplemented in Scribunto_LuaSandboxInterpreter, and Scribunto_LuaStandaloneInterpreter.

◆ wrapPhpFunction()

Scribunto_LuaInterpreter::wrapPhpFunction ( $callable)
abstract

Wrap a PHP callable as a Lua function, which can be passed back into Lua.

If an error occurs, a Scribunto_LuaError will be thrown.

Parameters
callable$callableThe PHP callable
Returns
object a Lua function

Reimplemented in Scribunto_LuaSandboxInterpreter, and Scribunto_LuaStandaloneInterpreter.


The documentation for this class was generated from the following file: