Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → NULL value in cog?
NULL value in cog?
2001-09-18, 3:27 PM #1
Can you assign a variable a NULL value?

Like:

myvariable = NULL;

to wipe anything that's in it?
2001-09-18, 3:32 PM #2
myvariable = 0;

Generally, the "undefined" value is -1, for example, with jkStringOutput(), when there is no target, the second param is -1.
Capitalization
Commas
Periods
Question Marks
Apostrophes
Confusable Words
Plague Words
2001-09-18, 4:08 PM #3
Okay, what happens if you try to access an array with a -1 value?

I can't use '0' because all my arrays are 0-indexed arrays (players[0] - players[7] for instance).
2001-09-19, 6:17 AM #4
The best bet is it will do nothing, though it could probably crash the game, if the engine really tries to access something that doesn't exist, as arrays ALWAYS start off at 0.

[This message has been edited by Maverick (edited September 19, 2001).]
Maverick
2001-09-19, 5:00 PM #5
What do you actually mean?

If you want to turn array[X] value into nothing, just do

array[X] = 0;

You can't undefine any variables.

array[-1] can't just exist.

------------------
http://millennium.massassi.net/ - Millennium

↑ Up to the top!