Module:Coordinates: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
m (Changed protection level of Module:Coordinates: High-risk Lua module: allow template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))) |
(prevent blank degrees from being treated as 0) |
||
Line 186: | Line 186: | ||
]] |
]] |
||
local function convert_dec2dms(coordinate, firstPostfix, secondPostfix, precision) |
local function convert_dec2dms(coordinate, firstPostfix, secondPostfix, precision) |
||
local coord = tonumber(coordinate) |
local coord = tonumber(coordinate) |
||
local postfix |
local postfix |
||
if coord >= 0 then |
if coord >= 0 then |
||
Line 208: | Line 208: | ||
]] |
]] |
||
local function convert_dms2dec(direction, degrees_str, minutes_str, seconds_str) |
local function convert_dms2dec(direction, degrees_str, minutes_str, seconds_str) |
||
local degrees = tonumber(degrees_str) |
local degrees = tonumber(degrees_str) |
||
local minutes = tonumber(minutes_str) or 0 |
local minutes = tonumber(minutes_str) or 0 |
||
local seconds = tonumber(seconds_str) or 0 |
local seconds = tonumber(seconds_str) or 0 |