Skip to content

Commit

Permalink
Parsers; Correct priorities
Browse files Browse the repository at this point in the history
  • Loading branch information
gcask committed Oct 23, 2022
1 parent 34c647a commit 9dc8523
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Mods/Services/DCS-unicon/Scripts/DCS-unicon-GUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ end
-- Try to interpret the string as various formats.
-- input is prefiltered with whitespaces stripped and normalized.
function Dialog:tryConvert(input)
for _, parser in pairs(converters.coords.parsers) do
for _, parser in ipairs(converters.coords.parsers) do
local x, y = parser(input)
if x ~= nil then
self:updateCoordinates(x, y)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -406,5 +406,11 @@ function converters.coords.parsers.decodeLatLon(input)
return Terrain.convertLatLonToMeters(lat, lon)
end

-- Setup parsers priorities (array).
converters.coords.parsers[1] = converters.coords.parsers.decodeMGRS
converters.coords.parsers[2] = converters.coords.parsers.decodeUTM
converters.coords.parsers[3] = converters.coords.parsers.decodeDMS
converters.coords.parsers[4] = converters.coords.parsers.decodeDDM
converters.coords.parsers[5] = converters.coords.parsers.decodeLatLon

return converters

0 comments on commit 9dc8523

Please sign in to comment.