Module:Ordnance Survey coordinates/sandbox: Difference between revisions

Content deleted Content added
use unicode functions
make Lua more idiomatic
Line 53:
end
-- end hack
ifn = mw.ustring.len(n) == 0 thenand 0 or n
e = nmw.ustring.len(e) == 0 and 0 or e
end
if mw.ustring.len(e) == 0 then
e = 0
end
pr = math.pow(10.0,(5.0-pr))
local T1 = mw.ustring.byte(mw.ustring.sub(lett,1,1))-65
Line 286 ⟶ 282:
local function split(s,sep)
-- split a string s into chunks, separated by sep
if sep == nilsep or then"%s"
sep = "%s"
end
local t = {}
for chunk in mw.ustring.gmatch(s,"([^"..sep.."]+)") do
Line 315 ⟶ 309:
end
return html
end
 
local function empty(s)
return ifs == nil or mw.ustring.len(es) == 0 then
end
 
Line 320 ⟶ 318:
local args = getArgs(frame,{parentFirst=true,parentOnly=false,frameOnly=false})
local input = args[1]
if input == nil or mw.ustring.lenempty(input)==0 then
return warning(nil)
end
Line 337 ⟶ 335:
LL = {IrishEN2LL(firstArg,args[2])}
restargs = 3
if linktitle == nil or mw.ustring.lenempty(linktitle) == 0 then
linktitle=args[1]..'_'..args[2]
end
Line 344 ⟶ 342:
LL = {GBEN2LL(args[1],args[2])}
restargs = 3
if linktitle == nil or mw.ustring.lenempty(linktitle) == 0 then
linktitle=args[1]..'_'..args[2]
end
Line 351 ⟶ 349:
LL = {NGR2LL(args[1])}
restargs = 2
if linktitle == nil or mw.ustring.lenempty(linktitle) == 0 then
linktitle=args[1]
end