typedlua icon indicating copy to clipboard operation
typedlua copied to clipboard

Loops with gmatch and multiple captures

Open Zash opened this issue 8 years ago • 0 comments

This code:

local function foo(s : string) end

local str = "Hello World"

for a : string, b : string in string.gmatch(str,"(%w)(%w)") do
	foo(a);
	foo(b);
end

Gives this error when compiling:

test.tl:7:2: type error, attempt to pass '(nil)' to local 'foo' of input type '(string, value*)'
 foo(b);
 ^

Zash avatar Feb 11 '17 13:02 Zash