AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   CellArray of CellArrays (https://forums.alliedmods.net/showthread.php?t=102176)

Bad_Bud 08-30-2009 16:47

CellArray of CellArrays
 
I'm having trouble creating this, most likely because I don't understand the syntax.

PHP Code:

ArrayPushCell(StoreData,ArrayCreate(1,1))

ArrayPushCell(ArrayGetCell(StoreData,0),1337

That would be trying to put 1337 into the embedded cellarray, but it says "Invalid cellvector handle provided"

Alka 08-30-2009 16:55

Re: CellArray of CellArrays
 
PHP Code:

new Array:iArray ArrayCreate(1,1);
ArrayPushCell(iArray1337); 


Bad_Bud 08-30-2009 17:54

Re: CellArray of CellArrays
 
Quote:

Originally Posted by Alka (Post 918264)
PHP Code:

new Array:iArray ArrayCreate(1,1);
ArrayPushCell(iArray1337); 


No, I want to do this:

PHP Code:

new Array:iArray ArrayCreate(1,1);
new Array:
uArray ArrayCreate(1,1);
ArrayPushCell(iArrayuArray); 

I want to store an array handle in a cell of the other array, so I can have a dynamic one inside of a dynamic one.

Bad_Bud 08-30-2009 18:11

Re: CellArray of CellArrays
 
Edit: Forget what I had here if you read it.

I think I got it... it was just an out of bounds pointer. ;(

Took forever to find.

Alka 08-30-2009 18:18

Re: CellArray of CellArrays
 
StoreData has Array: tag ?! Also ArrayGetCell returns an integer...But as i can see it's a useless work, what are you trying to do anyway?

Bad_Bud 08-30-2009 18:23

Re: CellArray of CellArrays
 
Quote:

Originally Posted by Alka (Post 918327)
StoreData has Array: tag ?! Also ArrayGetCell returns an integer...But as i can see it's a useless work, what are you trying to do anyway?

It does appear to work... I'm sure I'm not the first one to do this.

I'm basically faking having objects.

It returns whatever you put in, since Pawn doesn't have datatypes. I could put a float in, and as long as I put it back in a float variable, it's fine. It might say tag mismatch, but it works.

Alka 08-30-2009 18:30

Re: CellArray of CellArrays
 
Yea, also you can do _: for undefined data type.

Bad_Bud 08-30-2009 18:33

Re: CellArray of CellArrays
 
Oh? Does that make it ignore all tag mismatches?

Exolent[jNr] 08-30-2009 19:15

Re: CellArray of CellArrays
 
Code:
new Array:aAllArrays = ArrayCreate( 1, 1 ); new Array:aData = ArrayCreate( 1, 1 ); ArrayPushCell( aData, 1337 ); ArrayPushCell( aAllArrays, aData ); // ... new iValue = ArrayGetCell( Array:ArrayGetCell( aAllArrays, 0 ), 0 ); // iValue should be 1337


All times are GMT -4. The time now is 15:05.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.