local keyword with multiple variables

Hey guys, just a problem that I’ve come across which I can’t seem to find a direct answer to on the google.

So if I declare a var in a local scope, I use the local keyword:

function foo()  
 local x = 1;  
end  

which makes it inaccessible to an outer scope. And if, in the assignment of the variable, I call a function, I would do this:

function foo()  
 local x = foo2();  
end  

which works the same. Now, my question is, if foo2() has multiple returns, and I do:

function foo()  
 local x, y = foo2();  
end  

will both x and y have the local keyword applied? or would I have to do:

function foo()  
 local x;  
 local y;  
 x, y = foo2();  
end  

any help appreciated [import]uid: 68278 topic_id: 13061 reply_id: 313061[/import]

local x, y = foo() is just fine. i tested. [import]uid: 46529 topic_id: 13061 reply_id: 47951[/import]

thanks a bunch [import]uid: 68278 topic_id: 13061 reply_id: 47969[/import]

Only x will receive a value, y will be nil. And semicolons are optional.
if you do
local x, y = foo2(), foo2()
then both of them will have a value [import]uid: 58303 topic_id: 13061 reply_id: 48042[/import]

@Lerg

He says function has multiple returns.

i.e.

function foo()  
 return 0,1  
end  

so, local x,y = foo() is ok. [import]uid: 46529 topic_id: 13061 reply_id: 48043[/import]

Ah, didn’t notice. [import]uid: 58303 topic_id: 13061 reply_id: 48044[/import]