Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do i get the second value of string.gsub?

Asked by 4 years ago
Edited 4 years ago

string.gsub("121113", "1", "1") returns when printing a second value. How do i get that second value?

print(string.gsub("12113", "1", "1"))

returns:

121113 3

how do i get that last "3" ?

what i tryed:

local Number = string.gsub("12113", "1", "1")
print(string.gsub(Number,"12113", ""))

1 answer

Log in to vote
0
Answered by 4 years ago
local string, matches = string.gsub("12113","1","1")
print(string)
print(matches)

Output:

12113 3

Ad

Answer this question