Garry's Mod Wiki

string.Interpolate

  string string.Interpolate( string str, table lookuptable )

Description

Interpolates a given string with the given table. This is useful for formatting localized strings.

Arguments

1 string str
The string that should be interpolated.
2 table lookuptable
The table to search in.

Returns

1 string
The modified string.

Example

Example on how to use this function.

local tbl = { ["Name"]= "Jerry" } print( string.Interpolate( "Hello {Name}!", tbl ) )
Output:
Hello Jerry!