Пример #1
0
 /**
  * Parser function hook for the #luaexpr function
  * @param $parser Parser
  * @param $param1 bool
  * @return string
  */
 public static function renderExpr(&$parser, $param1 = FALSE)
 {
     global $wgLua;
     # Create a new LuaWrapper if needed
     if ($wgLua === null) {
         $wgLua = new LuaWrapper();
     }
     # Execute this Lua chunk, wrapped in io.write().
     if ($param1 == false) {
         return '';
     }
     try {
         return $wgLua->wrap("io.write({$param1})");
     } catch (LuaError $e) {
         return $e->getMessage();
     }
 }