Funzione
Nativa
string.gsub
Returns a copy of s in which all (or the first <code>n</code>, if given) occurrences of the <code>pattern</code> have been replaced by a replacement string specified by <code>repl</code>.
Non ancora tradotto
Sintassi
string.gsub(string, pattern, replacement, maxReplaces)
Parametri
| Nome | Tipo | Predefinito | Descrizione |
|---|---|---|---|
string
|
string | — | String which should be modified. |
pattern
|
string | — | The pattern that defines what should be matched and eventually be replaced. |
replacement
|
string | — | In case of a string the matched sequence will be replaced with it. In case of a table, the matched sequence will be used as key and the table will tested for the key, if a value exists it will be used as replacement. In case of a function all matches will be passed as parameters to the function, the return value(s) of the function will then be used as replacement. |
maxReplaces
|
number | — | Maximum number of replacements to be made. |
Valore restituito
- string
- number