Hi,
I am new to AppGameKit Basic and I like it so far, yet I have problems with the documentation, as it seems confusing or incomplete at times. Thus I stumbled upon some commands, that I coudn't find proper documentation for.
First do #include headers have some kind of auto guard present, because most of my basecode depends on other parts and thus one file gets included over and over again, possibly, by itself and other parts, I have not run into problems so far, but coming from c and c++ I am confused as #insert is more like the c version and produces the double inclusion error, so I think the answer is yes, that #include has auto guards?
Another strange thing is that all inclusion paths are relative to the main.agc file, which means that if you wanna use lib code which has multiple files and is in a folder of it's own you need to include all the files within the lib as if they were included from outside the folder, this is not a good thing.
I can't find anything on what local does or what it is good for.
http://www.appgamekit.com/documentation/principles/1_datatypes.htm
Quote: "All arrays are created as global arrays, which means you can access their data from anywhere in your program. It is important to note that a global array must be declared at the top of the main source code of the program as arrays are dynamically created only when the DIM command is executed. Placing DIM commands at the top of included source code will not dynamically create the array unless it lies within a subroutine called from the main program. Essentially, your program has to DIM the array before it can access the array for reading and writing."
VS
Quote: "To maintain backwards compatibility arrays can still be defined with DIM, but version 2 introduces a new method of defining arrays that will become particularly important when defining them in types. Note that both DIM arrays and new style arrays perform exactly the same after they are declared so any functions mentioned here will also work on DIM arrays. The new method is mainly for consistency. The new method is as follows"
So if I declare something like this is it a global array and/or do I need to undim it at the end of the function, do I need to put local before b and c?
Does changing the length of an array to -1 free all it's elements or am I producing memory leaks.
Function a()
b as String[]
c as Integer
EndFunction
Thanks,
This forum needs a preview button for posts and I still don't know my username.