Garry's Mod Wiki

Revision Difference

string.Interpolate#548679

<function name="Interpolate" parent="string" type="libraryfunc"> <added>2023.01.17</added> <description>Interpolates a given string with the given table.</description> <realm>Shared and Menu</realm> <file line="370-L378">lua/includes/extensions/string.lua</file> <args> <arg name="str" type="string">The string that should be interpolated.</arg> <arg name="lookuptable" type="table">The table to search in.</arg> </args> <rets> <ret name="" type="string">The modified string.</ret> </rets> </function> <example> <description>Example on how to use this function.</description> <code> local tbl = { ["Name"]= "Jerry" } print( string.Interpolate( "Hello {Name}!", tbl ) ) </code> <output> ``` Hello Jerry! ``` </output> </example>