Hi,
I don't know where you got that idea. No, I didn't say that. My point
to Dark was that you can't call a function that hasn't been defined in
your script somewhere.
If you recall Dark said he didn't understand why he was writing an
add_numbers(() function when in the body of main he had already added
the numbers 3 and 5. What he failed to grasp at that point is that the
add_numbers function he used in main() hadn't been created yet. He
actually defines the contents of the add_numbers() function later on
in his script. Otherwise you can't call a function that doesn't exist.
A better way to explain it is when you open a book to the table of
contents and it tells you chapter 5 is on page 75. Well, what happens
if there is no page 75 in the book? The obvious answer is  you can't
look up the contents of chapter 5 right?
Well, when writing scripts a similar concept comes into play. If you
write a little piece of code like

void main ()
{
    int result = add_numbers (3, 5);
}

What you are telling main to do is to call the add_numbers function,
which should exist somewherein your script, and take the numbers 3 and
5 and add them together, and then return the result which happens to
be 8. If the add_numbers() function doesn't exist it is like turning
to a blank page in the book and the script can't continue. That's all
I was getting at.
However, to answer your immediate question i believe main can appear
anywhere in a BGT script.  Although, in a lot of the examples I've
seen it appears at the top of the scripts. This makes sense since it
is the entry point for the script and initializes everything else.

Cheers!


On 3/25/10, Andy <musicproa...@gmail.com> wrote:
> Hi Thom,
> So you're saying, then, that main has to be at the bottom of the program?

---
Gamers mailing list __ Gamers@audyssey.org
If you want to leave the list, send E-mail to gamers-unsubscr...@audyssey.org.
You can make changes or update your subscription via the web, at
http://audyssey.org/mailman/listinfo/gamers_audyssey.org.
All messages are archived and can be searched and read at
http://www.mail-archive.com/gam...@audyssey.org.
If you have any questions or concerns regarding the management of the list,
please send E-mail to gamers-ow...@audyssey.org.

Reply via email to