MediaWiki  1.34.0
Scribunto_LuaInterpreter Class Reference
Inheritance diagram for Scribunto_LuaInterpreter:

Public Member Functions

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

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_LuaStandaloneInterpreter, and Scribunto_LuaSandboxInterpreter.

◆ isLuaFunction()

Scribunto_LuaInterpreter::isLuaFunction (   $object)
abstract

Test whether an object is a Lua function.

Parameters
object$object
Returns
bool

Reimplemented in Scribunto_LuaStandaloneInterpreter, and Scribunto_LuaSandboxInterpreter.

◆ 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_LuaStandaloneInterpreter, and Scribunto_LuaSandboxInterpreter.

◆ pauseUsageTimer()

Scribunto_LuaInterpreter::pauseUsageTimer ( )
abstract

Pause CPU usage and limits.

Returns
void

Reimplemented in Scribunto_LuaStandaloneInterpreter, and Scribunto_LuaSandboxInterpreter.

◆ 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_LuaStandaloneInterpreter, and Scribunto_LuaSandboxInterpreter.

◆ unpauseUsageTimer()

Scribunto_LuaInterpreter::unpauseUsageTimer ( )
abstract

Unpause CPU usage and limits.

Returns
void

Reimplemented in Scribunto_LuaStandaloneInterpreter, and Scribunto_LuaSandboxInterpreter.

◆ 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_LuaStandaloneInterpreter, and Scribunto_LuaSandboxInterpreter.


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