WorldToScreenPoint returns a Vector3 and a boolean. However, I can't read the boolean in any way I tried. How do I read it?
To receive multiple return values, use multiple assignment:
local function getFirstThreeNumbers() return 1, 2, 3 end local first, second, third = getFirstThreeNumbers()
Extra return results will be discarded:
local function getFirstNumbers() return 1, 2, 3, 4 end local first, second, third = getFirstNumbers() -- Fourth return value discarded. local anotherFirst, anotherSecond, anotherThird, anotherFourth = getFirstNumbers() local moreFirst = getFirstNumbers()
Extra variables in multiple assignment will get nil
:
local function getFirstNumbers() return 1, 2, 3, 4 end local first, second, third, fourth, fifth, sixth = getFirstNumbers() print(fifth) --> nil print(sixth) --> nil