Functions calling Functions & Arrays

Blitz3D Forums/Blitz3D Programming/Functions calling Functions & Arrays

WightNight(Posted 2004) [#1]
I have a Globals.bb, and an includes.bb with my arrays dimmed globally and my functions as include files. It works, well mostly. The trouble is that some of my functions call other functions that process arrays. The complier on run states that it "Can not find Function X" which is really an array, not a function. I'm not trying to pass arrays just process them in the second level function. What am I doing wrong?


fredborg(Posted 2004) [#2]
The arrays need to be Dim'ed before the functions are present in the source.

So if you Dim the arrays in your globals.bb include, you need to include that first, and your functions second.

This doesn't work:
Function Bob()
	Print myarray(1)
End Function

Dim myarray(1)
But this does:
Dim myarray(1)

Function Bob()
	Print myarray(1)
End Function



WightNight(Posted 2004) [#3]
D'uh! Thanks for the help!