Thread Tools Display Modes
Prev Previous Post   Next Post Next
10-21-19, 04:07 AM   #1
Dissosiative
A Defias Bandit
Join Date: Dec 2008
Posts: 2
Search for multiple variables

Code:
Rawr_Locations = {}
Rawr_Locations["North"] = {x = 35, y = 24}
Rawr_Locations["South"] = {x = 32, y = 36}


function Rawr_GetClosest()
	local closestSpot = "";
	local closestDistance = 999999999;
	--local px,py=GetPlayerMapPosition("player")
	
	local px, py = Rawr_GetPosition();
	
	for locationName, loc in pairs(Rawr_Locations)
	do
		local distance = math.dist(loc.x, loc.y, px*100, py*100)
		if distance < closestDistance
		then
			closestSpot = locationName;
			closestDistance = distance;
		end
	end
	
	return closestSpot;
end
I need to keep North and south static but I need to search multiple X and Y cordinates North and South.

ie: Rawr_Locations["North"] = {x = 35, y = 24 OR x = 31, y = 12 }
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Search for multiple variables


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off