Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

P4 Extensions Documentation | 2025.1

# Class Helix.Core.Server

## Class methods

### ClientEditData( string, function ) -> bool, string

Allow Lua writer using RunCommand to send an input form to the User for editing.

Returns:

bool - return 1 on success, otherwise 0

string - with edited content of the form if success, with unedited content of the form containing an error message on failure

#### Example

Copy

    local ret, formin = Helix.Core.Server.ClientEditData( formout, Validator )
    if ret then
    Helix.Core.Server.ClientOutputText( "Form-in is:\n" )
    Helix.Core.Server.ClientOutputText( formin )
    Helix.Core.Server.ClientOutputText( ".... Done\n" )
    else
    Helix.Core.Server.ClientOutputText( "Client Edit error " .. formin .. "\n")
    end

### ClientOutputText(string)

Used in an Extension-implemented custom command to send output during the execution of the command, whereas SetClientMsg(string) sets the message to be sent to the user after the extension completes its execution.

### GetArchDirFileName(string) -> string

Gets the path to a file under the server extension archive directory.

Returns the path to the file in the server extension’s unpacked archive directory. This path is relative to the server.extensions.dir configurable.

### GetArchiveFileInfo() -> string, string, string, number, string

Get information about the current file in the Archive() event

Returns:

string | string | string | number | string
--- | --- | --- | --- | ---
name of the file | a string that represents the revision number of the file. For example, "1.9876.1" where: 1. is the conventional prefix to the changelist number 9876 represents the changelist number .1 is the initial suffix that can increment to uniquely identify a shelved revision in P4 Server version 2020.2 and later | file type | size of file in bytes | digest of file

### GetDataDirFileName(string) -> string

Gets the path to a file under the server extension data directory.

Returns:

Passed a file name argument, returns the path in which the server extension will store the files it creates.

### GetGlobalConfigData() -> table

Gets the global config table.

Returns:

A table of the values the user provided when filling out the global server extension config.

### GetInstanceConfigData() -> table

Gets the instance config table.

Returns:

A table of field names and sample values used during the instance configuration of an server extension. This should be information the server extension needs for this instance of itself. It is the responsibility of the server extension to validate and format this data. Field names must not contain whitespace.

### GetVar(string) -> string

Returns:
The value of the requested server extension session variable. See Server extension session variables.

### GlobalConfigFields() -> table

Gets the global configuration setup.

Returns:

A table of field names and sample values used during the global configuration of a server extension. This should be information the server extension needs for all instances of itself. It is the responsibility of the server extension to validate and format this data. Field names must not contain whitespace.

### InstanceConfigFields() -> table

Gets the instance configuration setup

Returns:

A table of field names and sample values used during configuration of an instance of a server extension. This should be information the server extension needs to perform specific actions, such as the list of file paths to monitor. It is the responsibility of the server extension to validate and format this data. Field names must not contain whitespace.

### InstanceConfigEvents() -> table

Server event registration. See Server extension callbacks.

Returns:

A table of events and parameters. The parameters are likely dependent on the data retrieved from the instance configuration.

### ReportError(number, string)

For Extension-implemented custom commands, returns the string to the client and returns an exit code.

Number Argument | Descriptive field prepended with -s global command option | Exit Code
--- | --- | ---
`Helix.Core.P4API.ErrorSeverity.E_WARN` | warning | `0`
`Helix.Core.P4API.ErrorSeverity.E_ERROR` | error | `0`
`Helix.Core.P4API.ErrorSeverity.E_FATAL` | error | `1`

For Extension-implemented custom commands, ClientOutputText(string) can also return strings to the client.

### log(table)

Accepts a table of user data and appends it to the log.json file in the server extension data directory as line-delimited JSON.

### SetArchiveFileSys() -> FileSys

For archive server extensions, give the server a FileSys instance to use for accessing the archive content.

Returns:

The FileSys object.

### SetClientMsg(string)

Sets the message to be sent to the user after the extension completes its execution, whereas `ClientOutputText` is used in a Extension-implemented custom command to send output during the execution of the command.

Your search for returned results