Skip to content

Conversation

@Bapham12
Copy link
Member

Add Coordinates module for handling geographic coordinates in Lua, including conversion functions and display methods.

Add Coordinates module for handling geographic coordinates in Lua, including conversion functions and display methods.
@Bapham12 Bapham12 merged commit 50704c4 into main Jan 14, 2026
2 checks passed
@Bapham12 Bapham12 deleted the Bapham12-patch-2 branch January 14, 2026 13:05
Comment on lines +400 to +404
if long_f == "B" or lat_f == "Đ" or lat_f == "T" then
local englishFlags = {B = "N", N = "S", T = "W", ["Đ"] = "E"}
local lat_f = englishFlags[lat_f] or lat_f
local long_f = englishFlags[long_f] or long_f
end
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable shadowing bug. Using local keyword creates new local variables instead of modifying the function parameters lat_f and long_f. These reassignments will have no effect on the rest of the function, causing Vietnamese hemisphere flags to not be converted to English.

-- Remove 'local' keyword to modify the actual parameters:
if long_f == "B" or lat_f == "Đ" or lat_f == "T" then
    local englishFlags = {B = "N", N = "S", T = "W", ["Đ"] = "E"}
    lat_f = englishFlags[lat_f] or lat_f
    long_f = englishFlags[long_f] or long_f
end
Suggested change
if long_f == "B" or lat_f == "Đ" or lat_f == "T" then
local englishFlags = {B = "N", N = "S", T = "W", ["Đ"] = "E"}
local lat_f = englishFlags[lat_f] or lat_f
local long_f = englishFlags[long_f] or long_f
end
if long_f == "B" or lat_f == "Đ" or lat_f == "T" then
local englishFlags = {B = "N", N = "S", T = "W", ["Đ"] = "E"}
lat_f = englishFlags[lat_f] or lat_f
long_f = englishFlags[long_f] or long_f
end

Spotted by Graphite Agent

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

table.insert(errors, {source, "vĩ độ < 0 có chữ bán cầu"})
end
if long_d < 0 then
table.insert(errors, {source, "vĩ độ < 0 có chữ bán cầu"})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect error message. The error message says "vĩ độ < 0 có chữ bán cầu" (latitude < 0 with hemisphere) but this is checking long_d < 0 (longitude). This will confuse users debugging coordinate errors.

table.insert(errors, {source, "kinh độ < 0 có chữ bán cầu"})
Suggested change
table.insert(errors, {source, " độ < 0 có chữ bán cầu"})
table.insert(errors, {source, "kinh độ < 0 có chữ bán cầu"})

Spotted by Graphite Agent

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants