I was trying to split a string into a table, by using gmatch with %S+
. However I ran into the error:
Attempt to index local 'args' (a function value)
Here are the three lines of code I believe have the problem:
print(msg)
local args = string.gmatch(msg, "%S+")
print(args[1])
So the first line print(msg)
just prints a normal string, as it should. The second line is suppose to split that string by spaces, and store the table in args. The third line is suppose to print the first value in the table, however instead it gives me the error shown above. Thanks.