Hard to find bug in my app

new topic     » topic index » view thread      » older message » newer message

Short version:

Function calls don't actually *require* you to receive the returned value. Is this expected and intended behavior? It resulted in a hard to find logic error for this newbie.

              • long boring version with background info and example code

I'm a casual programmer, decided I was going to relearn Eu, and was excited to find OpenEu was moving to 4.0. So I installed it, and downloaded a few things I thought looked interesting, one of which includes Raymond Smith's EuAllegro wrappers.

Was playing with one of his examples, decided to comment it to figure out how it worked. While doing that, I also decided to change some stuff that I thought should be organized differently. One of them was a collision check outside of the collision check function call. He had 3 collision checks, one for the left, one for the right, and one for straight ahead. The one for straight ahead was out of the collision check function.

So I moved the straight ahead collision check to the proper function, and replaced his old code with a call to the function. But the app no longer registered those collisions, although it registered the left and right collisions.

Tried to track the error down over a couple of days. Last night finally figured it out. I was returning a value to the function, but my call to that function did not have a variable to receive the returned value. For example:

function colcheck() fin = TRUE end function

... some stuff colcheck()

if fin = TRUE then exit() end if

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu