Feefty Posted November 16, 2012 Group: Members Topic Count: 47 Topics Per Day: 0.01 Content Count: 175 Reputation: 14 Joined: 11/21/11 Last Seen: April 18, 2020 Share Posted November 16, 2012 how do you destroy or unset an array? Thanks. Quote Link to comment Share on other sites More sharing options...
Dastgir Posted November 16, 2012 Group: Members Topic Count: 26 Topics Per Day: 0.01 Content Count: 331 Reputation: 63 Joined: 11/29/11 Last Seen: Saturday at 10:21 AM Share Posted November 16, 2012 cleararray @array[0],0,127; This will turn all values till [127] to 0 1 Quote Link to comment Share on other sites More sharing options...
Ryokem Posted November 16, 2012 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 205 Reputation: 19 Joined: 10/12/12 Last Seen: November 7, 2013 Share Posted November 16, 2012 (edited) oh was too slow Edited November 16, 2012 by Ryokem Quote Link to comment Share on other sites More sharing options...
KeyWorld Posted November 16, 2012 Group: Members Topic Count: 9 Topics Per Day: 0.00 Content Count: 379 Reputation: 304 Joined: 11/10/11 Last Seen: December 2, 2014 Share Posted November 16, 2012 You can even use deletearray without to specify index or size. deletearray .array; 2 Quote Link to comment Share on other sites More sharing options...
Feefty Posted November 16, 2012 Group: Members Topic Count: 47 Topics Per Day: 0.01 Content Count: 175 Reputation: 14 Joined: 11/21/11 Last Seen: April 18, 2020 Author Share 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 Link to comment Share on other sites More sharing options...
Emistry Posted November 16, 2012 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: Sunday at 05:32 PM Share 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 Link to comment Share on other sites More sharing options...
GmOcean Posted November 16, 2012 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 666 Reputation: 93 Joined: 04/27/12 Last Seen: August 17, 2015 Share 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 Link to comment Share on other sites More sharing options...
Feefty Posted November 17, 2012 Group: Members Topic Count: 47 Topics Per Day: 0.01 Content Count: 175 Reputation: 14 Joined: 11/21/11 Last Seen: April 18, 2020 Author Share Posted November 17, 2012 Thanks! Quote Link to comment Share on other sites More sharing options...
Question
Feefty
how do you destroy or unset an array?
Thanks.
Link to comment
Share on other sites
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.