Reputation: 4941
According to the book, this part of code is dividing a line in 2 parts, I do not understand the difference between %S and %s ,neither how exactly is it dividing it in two parts.
local namefrom, nameto = string.match(line, "(%S+)%s+(%S+)")
Upvotes: 1
Views: 4144
Reputation: 249394
According to the documentation, %s means whitespace, and %S means anything other than whitespace. So that match expression will split on one or more whitespace characters, capturing the two strings on either side.
Upvotes: 4