Jump to content

table.remove


IIYAMA

Recommended Posts

Posted

Yes, an iteration statement loops through all indexes in an array (you can call it array or table), 'i' and 'v' are the values from where the loop is (I just can't explain it better to you), you don't need to get the value of 'i' in the array again, simply use 'v' instead - that's what iteration statement vars are for, otherwise I'd use a while statement instead or anything else.

Posted

Yes i know this of course. I just did not understand what was your problem with my code. If i would use v instead, it wouldn't work well, but i've already explained this somewhere above.

Posted

He wanted to know how to remove them, so I found out how could he do it.

Yes it sounds easier. My only problem with it is: the table would grow just bigger and bigger without removing unused values. But I don't think this really matters.

Posted

Then some more code is needed to delete the unused values of the table, so there would not be less code just easier code! Hehe... okay don't take this serious, that was just my first thought when I read your post :)

Good night, thanks for the discussion.

Posted

I don't think it would be needed to delete these indexes with nil value, so it is easier. Though, if it's for some reason needed, both ways would end up doing the same, yes.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...