コード例 #1
0
 /** Parser function hook for the #luaexpr function */
 public static function renderExpr(&$parser, $param1 = FALSE)
 {
     global $wgLua;
     # Create a new LuaWrapper if needed
     if (!isset($wgLua)) {
         $wgLua = LuaWrapper::create();
     }
     # 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();
     }
 }