MediaWiki
1.34.4
LuaLibrary.php
Go to the documentation of this file.
1
<?php
2
3
namespace
MediaWiki\Extensions\ParserFunctions
;
4
5
use
Scribunto_LuaError
;
6
use
Scribunto_LuaLibraryBase
;
7
8
class
LuaLibrary
extends
Scribunto_LuaLibraryBase
{
9
public
function
register
() {
10
$lib = [
11
'expr'
=> [ $this,
'expr'
],
12
];
13
14
return
$this->
getEngine
()->registerInterface(
15
__DIR__ .
'/mw.ext.ParserFunctions.lua'
, $lib, []
16
);
17
}
18
19
public
function
expr
( $expression =
null
) {
20
$this->
checkType
(
'mw.ext.ParserFunctions.expr'
, 1, $expression,
'string'
);
21
try
{
22
$exprParser =
new
ExprParser
();
23
return
[ $exprParser->doExpression( $expression ) ];
24
}
catch
(
ExprError
$e ) {
25
throw
new
Scribunto_LuaError
( $e->getMessage() );
26
}
27
}
28
29
}
Scribunto_LuaError
Definition:
LuaCommon.php:992
MediaWiki\Extensions\ParserFunctions\ExprParser
Definition:
ExprParser.php:71
MediaWiki\Extensions\ParserFunctions\LuaLibrary\expr
expr( $expression=null)
Definition:
LuaLibrary.php:19
Scribunto_LuaLibraryBase\getEngine
getEngine()
Get the engine.
Definition:
LibraryBase.php:56
Scribunto_LuaLibraryBase\checkType
checkType( $name, $argIdx, $arg, $expectType)
Check the type of a variable.
Definition:
LibraryBase.php:141
Scribunto_LuaLibraryBase
This class provides some basic services that Lua libraries will probably need.
Definition:
LibraryBase.php:27
MediaWiki\Extensions\ParserFunctions
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Ge...
Definition:
ExprError.php:19
MediaWiki\Extensions\ParserFunctions\ExprError
Definition:
ExprError.php:24
MediaWiki\Extensions\ParserFunctions\LuaLibrary
Definition:
LuaLibrary.php:8
extensions
ParserFunctions
includes
LuaLibrary.php
Generated on Thu Sep 24 2020 22:29:08 for MediaWiki by
1.8.18