swiftlys2/docs/api/ai/
API Reference StringTable

IStringTable

Interface
Namespace: SwiftlyS2.Shared.StringTable · Assembly: SwiftlyS2.CS2.dll
public interface IStringTable
View source

Properties

NumStrings

Gets the number of strings in the string table.

int NumStrings { get; }
Property Value

TableId

Gets the ID of the string table.

int TableId { get; }
Property Value

TableName

Gets the name of the string table.

string TableName { get; }
Property Value

Methods

FindStringIndex(string)

Finds the index of the specified string in the string table.

int? FindStringIndex(string str)
Parameters
  • strstringThe string to find the index of.
Returns
The index of the string, or null if the string is not found.

GetOrAddString(string)

Gets the index of the specified string in the string table, or adds it if it does not exist.

int GetOrAddString(string str)
Parameters
  • strstringThe string to get or add.
Returns
The index of the string, or new index if the string is not found and added.

GetString(int)

Gets the string at the specified index.

string? GetString(int index)
Parameters
  • indexintThe index to get the string from.
Returns
The string at the specified index, or null if the index is invalid.

GetStringUserData(int)

Gets the user data for the specified index.

StringTableOutUserData GetStringUserData(int index)
Parameters
  • indexintThe index to get the user data from.
Returns
The user data, or invalid if the index is invalid.

GetStringUserData(string)

Gets the user data for the specified string.

StringTableOutUserData GetStringUserData(string str)
Parameters
  • strstringThe string to get the user data for.
Returns
The user data, or invalid if the string is not found.

IsStringIndexValid(int)

Checks if the specified index is valid.

bool IsStringIndexValid(int index)
Parameters
  • indexintThe index to check.
Returns
True if the index is valid, false otherwise.

ReplicateUserData(int, StringTableUserData, in CRecipientFilter)

Replicates the user data for the specified string to the specified recipients.

void ReplicateUserData(int stringIndex, StringTableUserData userData, in CRecipientFilter filter)
Parameters
  • stringIndexintThe index of the string to replicate the user data for.
  • userDataStringTableUserDataThe user data to replicate.
  • filterCRecipientFilterThe recipients to replicate the user data to.

ReplicateUserData(string, StringTableUserData, in CRecipientFilter)

Replicates the user data for the specified string to the specified recipients. Notice that the string MUST be already added to the string table BEFORE A FEW TICKS. If the string is not added, the replication will fail. If the string is added only 1-2 ticks ago before this call, the server will overwrites the replicated value.

void ReplicateUserData(string str, StringTableUserData userData, in CRecipientFilter filter)
Parameters
Exceptions

SetOrAddStringUserData(string, StringTableUserData, bool)

Sets the user data for the specified string, or adds the string and set if it does not exist.

bool SetOrAddStringUserData(string str, StringTableUserData userData, bool forceOverride = true)
Parameters
  • strstringThe string to set the user data for.
  • userDataStringTableUserDataThe user data to set.
  • forceOverridebooloptionalWhether to override the user data if it already exists.
Returns
True if the user data was successfully set or added, false otherwise.

SetStringUserData(int, StringTableUserData, bool)

Sets the user data for the specified index.

bool SetStringUserData(int index, StringTableUserData userData, bool forceOverride = true)
Parameters
  • indexintThe index to set the user data for.
  • userDataStringTableUserDataThe user data to set.
  • forceOverridebooloptionalWhether to override the user data if it already exists.
Returns
True if the user data was successfully set, false otherwise.
Exceptions

SetStringUserData(string, StringTableUserData, bool)

Sets the user data for the specified string.

bool SetStringUserData(string str, StringTableUserData userData, bool forceOverride = true)
Parameters
  • strstringThe string to set the user data for.
  • userDataStringTableUserDataThe user data to set.
  • forceOverridebooloptionalWhether to override the user data if it already exists.
Returns
True if the user data was successfully set, false otherwise.
Exceptions

TryGetStringUserData(int, out StringTableOutUserData)

Tries to get the user data for the specified index.

bool TryGetStringUserData(int index, out StringTableOutUserData result)
Parameters
Returns
True if the user data was successfully retrieved, false otherwise.

TryGetStringUserData(string, out StringTableOutUserData)

Tries to get the user data for the specified string.

bool TryGetStringUserData(string str, out StringTableOutUserData result)
Parameters
Returns
True if the user data was successfully retrieved, false otherwise.