String array Q =\
I wanna pass something like this....
Code:
Code:
|
It should be possible, but you would need a native for it..
Can't you just pass the size to the function as an extra parameter? :) |
Adhering to the law that Small makes all the elements a 0 by default, here is how it will probably be done (although I'd recommend passing the parameter):
Code:
The problem with doing it this way is that the first dimension must be filled sequentially, i.e. var2[0][] must have a string (i.e. initialized to SOMETHING), var2[1][] must have a string .. etc , if var2[1][] does not have a string, but var2[2][] does, then this code will only go until it reaches an element without a string :). |
huh
that should give you a runtime error if you leave the array uninitialized :D also, if you write Code:
|
meh amx needs some easy functions like this one I hate passing like 6 diff things to a function just to get what I want =(
Although Thx I was way to tired to think of pasing the length =\ |
Re: String array Q =\
Quote:
Code:
|
Your talking about a single array, I'm talking about a double array.....
|
If the array/string is empty, the "size" would be 0. Size is not necessarily the same as length.
In my CS Metamap plugin ( http://forums.alliedmods.net/showthread.php?t=339 ) I have a function that looks like this: Code:
Matrix is a 2 dimensional array fitted inside a 1 dimensional array, and the size could vary but must of course anyway be known at compiletime, and this is done in the constants COLUMNS and LINES, so these have to be passed just as was discussed here. To access the matrix I use another set of functions for ease of use... Code:
If I remember right I think multidimensionals are supported in newer Small versions... Which would make working with matrixes a lot more easy. |
well I would settle for 3 seeded array myself =) would kill about 40+ vars in my newest plugin....
|
Quote:
|
| All times are GMT -4. The time now is 14:47. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.