Module:MapMarkersHelper: Difference between revisions
From HorizonXI Wiki
Starfox9507 (talk | contribs) No edit summary |
Starfox9507 (talk | contribs) No edit summary |
||
Line 6: | Line 6: | ||
--local sep = "|" | --local sep = "|" | ||
local posx, posy; | |||
str="a=b b=c name=george jetson name2=paul davidson company=radioshack" | str="a=b b=c name=george jetson name2=paul davidson company=radioshack" | ||
Line 11: | Line 13: | ||
str=str:gsub("%s(%S-)=","\n%1=") | str=str:gsub("%s(%S-)=","\n%1=") | ||
for name, value in string.gmatch(str, "(%S-)=(.-)\n") do | for name, value in string.gmatch(str, "(%S-)=(.-)\n") do | ||
if name == x then posx = value end | |||
if name == y then posy = value end | |||
end | end | ||
return posx + "," + posy | |||
end | end | ||
return h | return h |
Revision as of 04:17, 24 September 2023
Documentation for this module may be created at Module:MapMarkersHelper/doc
local h = {} function h._main(frame) local _location = frame.args.location if not _location then return "no location provided" end --local sep = "|" local posx, posy; str="a=b b=c name=george jetson name2=paul davidson company=radioshack" str=" "..str.."\n" str=str:gsub("%s(%S-)=","\n%1=") for name, value in string.gmatch(str, "(%S-)=(.-)\n") do if name == x then posx = value end if name == y then posy = value end end return posx + "," + posy end return h