Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
1

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

Asked by 2 days ago
Edited 2 days 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 2 days ago
local string, matches = string.gsub("12113","1","1")
print(string)
print(matches)

Output:

12113 3

Ad

Answer this question