Reading two gps with Lua

I use two gps. I can read location this way:
gps_position = gps:location(gps:primary_sensor())
lat = gps_position:lat() – for instance latitude

How can i get location from gps 2?

gps_position1 = gps:location(0)
gps_position2 = gps:location(1)

Probably advisable to do some error checking/use some assert statements when indexing peripherals this way. In particular, GPS2 may not be available to the scripting engine right away after boot, and attempting to access it could result in script errors.

gps_position1 = gps:location(0)
gps_position2 = gps:location(1)
Thanks, it works,