/** * Execute Lua code with the PHP extension. * * @param string $input * @return array<string> Stdout and stderr */ private function executeWithExtension($input) { // We're using the extension - verify it exists if (!class_exists('lua')) { throw new LooahException("The Lua extension is unavailable"); } // Create a lua instance and load the wrapper library $lua = new lua(); try { $lua->evaluatefile($this->getCompiledWrapperPath()); $lua->evaluate("wrap = make_wrapper({$this->maxLines}, {$this->maxRecursionDepth})"); $res = $lua->wrap($input); return array($res[0], $res[1]); } catch (Exception $e) { throw new LooahException("Could not the evaluate Lua sandbox wrapper script"); } }