• Returns a copy of s in which all (or the first n, if given) occurrences of the pattern have been replaced by a replacement string specified by repl, which can be a string, a table, or a function. gsub also returns, as its second value, the total number of matches that occurred.

    Parameters

    • str: string
    • pattern: string
    • repl: string
    • Optional n: number

    Returns LuaTuple<[string, number]>