# packet (script)

## Name

packet (script) — A script packet

## Synopsis

Content Model

    packet ::= (var*, line*, text
                tag*, packet*)

Attributes
See the general `packet` element documentation.

## Description

A script packet stores a Python script offering direct low-level access to the Regina calculation engine.

A script may contain variables representing other packets in the same packet tree; these are described by the child `var` elements.

The Python script itself is stored as a single `text` element. In older versions of Regina (4.95 and earlier) it was stored line-by-line using a sequence of `line` elements, but this method of storage is now deprecated.

If you are writing a file that must be read by older versions of Regina then you may write the script twice, first as a series of `line` elements (for Regina 4.95 and earlier), and then as a single `text` element (for Regina 4.96 and later).

### Warning

If you are writing both `line` and `text` elements, then the order is important.. This is because when Regina reads a `line` element it will append the line to the script, but when it reads a `text` element it will simply replace the entire script. Therefore, if the `line` elements appear after the `text` element, Regina will construct two copies of the script end-on-end.

The roles played by the child `tag` and `packet` elements are described in the general `packet` element documentation.

### Parents

The following elements contain `packet`: `packet`, `reginadata`.

### Children

The following elements occur in `packet` for a script packet: `line`, `packet`, `tag`, `text`, `var`.