SwiftlyS2

IStringTable

Interface IStringTable

Namespace: SwiftlyS2.Shared.StringTable

Assembly: SwiftlyS2.CS2.dll

public interface IStringTable

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
  • str string — The string to find the index of.
Returns
  • int? — 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
  • str string — The string to get or add.
Returns
  • int — 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
  • index int — The index to get the string from.
Returns
  • string? — 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
  • index int — The index to get the user data from.
Returns

GetStringUserData(string)

Gets the user data for the specified string.

StringTableOutUserData GetStringUserData(string str)
Parameters
  • str string — The string to get the user data for.
Returns

IsStringIndexValid(int)

Checks if the specified index is valid.

bool IsStringIndexValid(int index)
Parameters
  • index int — The index to check.
Returns
  • bool — 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
  • stringIndex int — The index of the string to replicate the user data for.
  • userData StringTableUserData — The user data to replicate.
  • filter CRecipientFilter — The 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
  • str string — The string to set the user data for.
  • userData StringTableUserData — The user data to set.
  • forceOverride bool — Whether to override the user data if it already exists.
Returns
  • bool — 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
  • index int — The index to set the user data for.
  • userData StringTableUserData — The user data to set.
  • forceOverride bool — Whether to override the user data if it already exists.
Returns
  • bool — 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
  • str string — The string to set the user data for.
  • userData StringTableUserData — The user data to set.
  • forceOverride bool — Whether to override the user data if it already exists.
Returns
  • bool — 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
  • index int — The index to get the user data from.
  • result StringTableOutUserData — The user data, or invalid if the index is invalid.
Returns
  • bool — 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
  • str string — The string to get the user data for.
  • result StringTableOutUserData — The user data, or invalid if the string is not found.
Returns
  • bool — True if the user data was successfully retrieved, false otherwise.

On this page