I tried to make an app that can view google map inside it
here’s my code
myMap = native.newMapView( 20, 20, 280, 300 )
--8.6662, 115.2278 = myMap:getAddressLocation ( "bendega warung" )
myMap.mapType = "standard"
myMap: setCenter ( -8.6662, 115.2279 )
local function callMap()
-- Fetch the user's current location
local currentLocation = myMap:getUserLocation()
if currentLocation then
-- Move map so that current location is at the center
local currentLatitude = currentLocation.latitude --I've tried to change latitude 9-8.6662) and longitude (115.2279) into number like above, still error
local currentLongitude = currentLocation.longitude
myMap:setCenter( currentLatitude, currentLongitude, true )
-- Look up nearest address to this location (this is returned as a "mapAddress" event, handled above)
myMap:nearestAddress( currentLatitude, currentLongitude )
end
end
callMap()
error message:
attempt to index global ‘myMap’ (a nil value) [import]uid: 197096 topic_id: 34984 reply_id: 334984[/import]