text = "1, 2, 3, 4"
_, _, a, b, c, d = string.find(text, "(%d+), (%d+), (%d+), (%d+)")
That is probably too finicky for use in the real world -- it won't match if there are extra spaces around the commas for example. This allows any number of spaces:
_, _, a, b, c, d = string.find(text, "(%d+)%s*,%s*(%d+)%s*,%s*(%d+)%s*,%s*(%d+)")
That's getting complicated enough that you may want to build up the pattern string.rep:
_, _, a, b, c, d = string.find(text, string.rep("(%d+)%s*,%s*", 3) .. "(%d+)")
|