Feefty Posted November 16, 2012 Posted November 16, 2012 how do you destroy or unset an array? Thanks. Quote
Dastgir Posted November 16, 2012 Posted November 16, 2012 cleararray @array[0],0,127; This will turn all values till [127] to 0 1 Quote
Ryokem Posted November 16, 2012 Posted November 16, 2012 (edited) oh was too slow Edited November 16, 2012 by Ryokem Quote
KeyWorld Posted November 16, 2012 Posted November 16, 2012 You can even use deletearray without to specify index or size. deletearray .array; 2 Quote
Feefty Posted November 16, 2012 Author Posted November 16, 2012 (edited) Thanks. Edit: How do you remove a single element? i tried deletearray .array[1], 1; // didnt work Edited November 16, 2012 by Feefty Quote
Emistry Posted November 16, 2012 Posted November 16, 2012 @Freefty refer this Deletearray in your script it will remove the .array[1] value .. if you want to know whether the array is deleted or value is removed...you can simple perform a check on the array.. for( set .@i,0; .@i < getarraysize( .array ); set .@i,.@i + 1 ) dispbottom ".array["+.@i+"] = "+.array[.@i]; Quote
GmOcean Posted November 16, 2012 Posted November 16, 2012 To clean a single value in an array use: cleararray .@arrary[1],0,1; OR set .@array[1],0; Either one of those will work, additionally, you can use copyarray to simply move values [2]->[127] down 1 thus, replacing [1] with [2], technically this removes [1]'s orignal value, but keeps the array in tact if you needed to add stuff to the end of the file. But the quick solotions i give in the code. 1 Quote
Question
Feefty
how do you destroy or unset an array?
Thanks.
7 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.