Page 1 of 1

Some LUA syntax help

Posted: Sun Aug 05, 2007 12:47 am
by jangoisbaddest
I just wanted to clear up some basic syntax questions I have as I read over the plethora of material both in the assets and on this site:

1) Normally I would have thought that if you say "TestVariable = 3", that would set the value of that variable to 3....but I have used a code from Archer01 (that works) which does the following: "local supportTeam = 3", which means that 3 is indeed a variable in this case; and if that is the case, how then, can one store a new variable with a value of 3?

2) What is the purpose of using "local" before defining a variable?

I probably had more questions, but I'm too tired to remember them at the moment.

Posted: Sun Aug 05, 2007 1:18 am
by Maveritchell
variable = [insertnumber]

Not sure what the confusion is, since in both cases the variable is on the left side of the equality.

I dunno about "local," it probably just denotes a variable specific to a small section of code.

Posted: Sun Aug 05, 2007 11:46 am
by jangoisbaddest
Maveritchell wrote:Not sure what the confusion is, since in both cases the variable is on the left side of the equality.
As I said, it appears to me that 3 is meant to be taken as the 3rd team, rather than an actual value for the variable. That is what is confusing me (it may have something to do with the "local" statement though).

Posted: Sun Aug 05, 2007 12:41 pm
by Ace_Azzameen_5
local means inside that function only (ScriptInit?) and not available to the rest of the LUA, as far as I know.

Support team? Is that from my post asking of linking two teams together? Maybe some more code is needed for us to get the context.

Posted: Sun Aug 05, 2007 2:28 pm
by Maveritchell
jangoisbaddest wrote:
Maveritchell wrote:Not sure what the confusion is, since in both cases the variable is on the left side of the equality.
As I said, it appears to me that 3 is meant to be taken as the 3rd team, rather than an actual value for the variable. That is what is confusing me (it may have something to do with the "local" statement though).
The number "3" is still just a numeric value. It's just that when the game asks for a team and is given a variable equal to 3, it equates it to the third team.