prettymuchbryce / easystarjs

An asynchronous A* pathfinding API written in Javascript.
MIT License
1.9k stars 165 forks source link

findPath returns a number #69

Closed EyesightTechnology closed 5 years ago

EyesightTechnology commented 5 years ago

Hello, I have this code

`function checkPath() { console.log(typeof path) if(path[1] === undefined) console.log("Null") else { console.log("Exists") powerValue = 1; } }

path = electrical_pathfind.findPath(coordX, coordY, powerSourceIndex[0][0], powerSourceIndex[0][1], checkPath); electrical_pathfind.calculate();`

Notice the typeof path line. This reads "Number." Sure enough, when I log "path," an integer value is logged - NOT an array.

What causes findPath to return a number rather then... well... a path? I have another completely separate pathfind system elsewhere in my code that works flawlessly - it returns an actual path!

prettymuchbryce commented 5 years ago

Hello there. Thanks for opening an issue. You might be interested in reading the documentation. I think it should answer your question.

EyesightTechnology commented 5 years ago

Hello there. Thanks for opening an issue. You might be interested in reading the documentation. I think it should answer your question.

I've read the documentation, and the issue clearly isn't addressed. Please point me to where I can find a solution to this issue.