generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Does a new entry to a table fill in empty spaces?

Previous Thread :: Next Thread 
ROBOFROG is not online. ROBOFROG
Joined: 04 Jan 2009
Total Posts: 1519
05 Jul 2015 05:00 PM
In more detail, assume I had a table with 10 listings, and then deleted the third listing. If I were to make a new listing would it fill in the third or make an eleventh?
Report Abuse
epicbreaker is not online. epicbreaker
Joined: 23 Apr 2011
Total Posts: 2791
05 Jul 2015 05:03 PM
It depends on two things.

table.remove() will automatically shift all indexes down.
table[pos] = nil will remove the index.

table.insert will however, insert at the very last place.
-------------
local tab = {1, 2, 3, 4}
tab[3] = nil
table.insert(tab, 5)
print(tab[5])
Report Abuse
ROBOFROG is not online. ROBOFROG
Joined: 04 Jan 2009
Total Posts: 1519
05 Jul 2015 05:03 PM
Or, would it make a tenth and the listings after 3 would move down 1?
Report Abuse
ROBOFROG is not online. ROBOFROG
Joined: 04 Jan 2009
Total Posts: 1519
05 Jul 2015 05:03 PM
Oh, heh, posted right after my last comment was verified. I appreciate the help.
Report Abuse
epicbreaker is not online. epicbreaker
Joined: 23 Apr 2011
Total Posts: 2791
05 Jul 2015 05:04 PM
table.remove() will do this:
local tab = {1, 2, 3, 4}
table.remove(tab, 3)
table.insert(tab, 5)
print(tab[4])
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image