Page 1 of 1

Global variables

PostPosted: Sat Apr 11, 2015 3:15 pm
by koala
Hi! :D

What is the difference between a variable defined in Global Code outside functions and variable defined with Variables->Add buttons?

Thanks! :D

Re: Global variables

PostPosted: Sat Apr 11, 2015 4:16 pm
by Turon
if you are asking if there is a difference between the variables you set in global code to the variables set in text editor, then no I wouldn't have thought so...

Re: Global variables

PostPosted: Sun Apr 12, 2015 12:22 am
by bat78
Short answer - They are much different.

  • Variables declared in global code can be more flexible. If you declare a variable using gE declarator you can not specify storage class, length modifiers and not even all the type qualifiers (the following are not supported by gE variable declarator pane: char, short, long long). You can't also declare them as pointers in there and you can not declare them as more than 1d arrays.
  • On the other hand, gE declarator dedicates save system that is handy, because it saves data in compressed variation and also groups it. Only variables declared there can be used by that system.
  • With gE declarator you can declare local variables. These will be members, part of the Actor structure. On that way, each actor will have its own new variable.
  • The "string" type in gE declarations pane is just an array of 256 chars.