Page 1 of 1

[06 Jan 2010] Is it possible to check if Table item table[numx] exists or not?

Posted: Sat Jun 13, 2020 5:32 pm
by Bugala
Note: This is an archived post that was originally sent to the Hollywood mailing list on Wed, 06 Jan 2010 18:30:06 -0000

I would need to check if some table item exists and then react on it, if it does.

Is this possible to do someway:

example:

Code: Select all

If table[num1][num2].varx "EXISTS" then table[num1][num2].varx=3
It would be useful for example on creating enemies, just check num1=num1+1 until table item doesnt exist and add new one there.

another one, concerning same. Is it possible to destroy table item?

I mean,

Code: Select all

deletetableitem table[num1][num2]
and after that if i point to table[num1][num2].varx, it would give me error, since it wouldnt exist anymore.

[06 Jan 2010] Re: Is it possible to check if Table item table[numx] exists or not?

Posted: Sat Jun 13, 2020 5:32 pm
by PEB
Note: This is an archived post that was originally sent to the Hollywood mailing list on Wed, 6 Jan 2010 11:44:34 -0800 (PST)

Check out the documentation for RawGet() and RemoveItem().