How to access point from playdate.gemoetry.lineSegment:intersectsLineSegment?

Sorry if this is an obvious question, but I can't seem to find it -

if I print the whole return of playdate.geometry.lineSegment:intersectsLineSegment(ls) I can see the point value, but I can't access it using ~.y, ~[2].y, ~.point.y... what's the correct way here?

Okay, I was able to get this by storing the return in a new table, then accessing newTable[2].y

fwiw, I do it this way:

local ls1 = geo.lineSegment.new( 20, 220,  380, 10 )
local ls2 = geo.lineSegment.new( 10, 100,  390, 90 ) 

local didCross -- will be true/false
local crossPoint -- will be a geo point

didCross, crossPoint = ls1:intersectsLineSegment( ls2 )

print( didCross )
printTable( crossPoint )

and if you want to use the faster version:

local didCross2
local crossPointX
local crossPointY

didCross2, crossPointX, crossPointY = ls1.fast_intersection(
        ls1.x1, ls1.y1, ls1.x2, ls1.y2,
        ls2.x1, ls2.y1, ls2.x2, ls2.y2 )

print( didCross2, crossPointX, crossPointY )
2 Likes