MediaWiki REL1_31
Scribunto_LuaParserFunctionsLibrary.php
Go to the documentation of this file.
1<?php
2
3class Scribunto_LuaParserFunctionsLibrary extends Scribunto_LuaLibraryBase {
4 public function register() {
5 $lib = [
6 'expr' => [ $this, 'expr' ],
7 ];
8
9 return $this->getEngine()->registerInterface(
10 __DIR__ . '/mw.ext.ParserFunctions.lua', $lib, []
11 );
12 }
13
14 public function expr( $expression = null ) {
15 $this->checkType( 'mw.ext.ParserFunctions.expr', 1, $expression, 'string' );
16 try {
17 return [ ExtParserFunctions::getExprParser()->doExpression( $expression ) ];
18 } catch ( ExprError $e ) {
19 throw new Scribunto_LuaError( $e->getMessage() );
20 }
21 }
22
23}
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Ge...
Definition ExprError.php:19
returning false will NOT prevent logging $e
Definition hooks.txt:2176