I'm trying to test the string.gmatch iterator. Problem is, the captures I'm specifying are somehow transforming to nil!
local Colors = {} print(script.Colors.Value) for k, v in string.gmatch(script.Colors.Value, "([%a]+)") do print(v) end
The child of the script is the stringvalue Colors, which holds the string, "Hello World, Die People,Apple" Yet my output is
nil >nil >nil >nil >nil >nil
string.gmatch does not work quite like pairs. It only returns matches, nothing else.
--Added the next two lines just to be safe. script:WaitForChild("Colors") repeat wait() until script.Colors.Value ~= "" print(script.Colors.Value) for match in string.gmatch(script.Colors.Value, "%a+") do --Not 'k', not 'v', just each match. print(match) end