Skip to content

PatchTable

Type

PatchTable

A patch table is a list of patch names used for Doom's composite texture system (see: PNAMES on the doom wiki).

Properties

Property Type Description
patches string[] An array of all patch names in the table
parent Archive The parent archive of the patch table

Constructors

PatchTable.new()

Creates a new, empty patch table.

Functions

Overview

Patches

Patch(index) -> string PatchEntry(index) -> ArchiveEntry PatchEntry(name) -> ArchiveEntry RemovePatch(index) -> boolean ReplacePatch(index, name) -> boolean AddPatch(name, allowDuplicate) -> boolean

Read/Write

LoadPNAMES(pnames) -> boolean WritePNAMES(pnames) -> boolean


Patch

Gets the name of the patch at index.

Parameters

  • index (integer): The patch index

Returns

  • string: The name of the patch at index, or "INVALID PATCH" if the index was out of bounds

PatchEntry (1)

Gets the associated ArchiveEntry for the patch at index in the list.

Parameters

  • index (integer): The patch index

Returns

  • ArchiveEntry: The associated ArchiveEntry for the patch at index, or nil if no entry was found or the given index was out of bounds

Notes

When searching for the patch entry, the parent archive of the table will be prioritised.


PatchEntry (2)

Gets the associated ArchiveEntry for the patch with the given name in the list.

Parameters

  • name (string): The patch name

Returns

  • ArchiveEntry The associated ArchiveEntry for the patch with the given name, or nil if no entry was found or the given name was not in the patch table

Notes

When searching for the patch entry, the parent archive of the table will be prioritised.


RemovePatch

Removes the patch at index from the table.

Parameters

  • index (integer): The patch index

Returns

  • boolean: false if the given index was out of bounds

ReplacePatch

Replaces the patch at index in the table with name.

Parameters

  • index (integer): The patch index
  • name (string): The new name for the patch

Returns

  • boolean: false if the given index was out of bounds

AddPatch

Adds a new patch with name to the end of the table.

Parameters

  • name (string): The name of the patch to add
  • allowDuplicate (boolean): If false, no new patch will be added if a patch already exists in the table with the given name

Returns

  • boolean: true if a new patch was added

LoadPNAMES

Clears any existing patches in the table and loads in PNAMES data from the given entry pnames.

Parameters

Returns

  • boolean: true on success

Notes

This will set the table's parent property to the parent archive of the given pnames entry.


WritePNAMES

Writes the patch table to pnames in PNAMES format.

Parameters

Returns

  • boolean: true on success