A Bug in code, need help figuring out the problem

Discuss any general programming issues here
Post Reply
Bugala
Posts: 1168
Joined: Sun Feb 14, 2010 7:11 pm

A Bug in code, need help figuring out the problem

Post by Bugala »

Here is the strangest Bug I have ever got in my code, for I know exactly where the bug is, yet I can't figure out why it does that.

I am not able to provide a short working example, but due to its nature, I can explain it with a couple of lines:

Code: Select all

ForEach(Actions.Availablemoves, Function(MapDataLocation, notused)
			MapDataLocation = ToNumber(MapDataLocation)
			DebugPrint("MapdataLocation: "..MapDataLocation)
			self.Map_MouseOverFuncs[MapDataLocation] = Function() self:Draw_Path(Actions.Availablemoves[MapDataLocation].path) EndFunction
What the fails is that it complains that at MapDataLocation 162 it doesnt have .path.

However, it does have. The strange thing here is that If I use variable "MapDataLocation", even that MapDataLocation in debugprint shows 162, it doesnt work.

But If I directly either write self:Draw_Path(Actions.Availablemoves[162].path, or if I manually set "MapDataLocation = 162" it works just fine.

But if I get it as Index, even using ToNumber() wont help. It simply keeps complaining that "path" doesnt exist.

To add more to this is that other MapDataLocation numbers work just fine, and they are set in same ForEach function elsewhere in the program as is index 162, so I see no reason why this specific 162 index would fail, while the rest don't.
Bugala
Posts: 1168
Joined: Sun Feb 14, 2010 7:11 pm

Re: A Bug in code, need help figuring out the problem

Post by Bugala »

@Andreas Looked at it more and seems to be Hollywood or Windows IDE bug, going to send you a picture proof through email since can't post images here easy enough. Image will show that Hollywood is actually going where it shouldn't and skipping some lines. For some reason that number 162 triggers the problem.
Post Reply