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: Removing a table from a table without using table.remove()?

Previous Thread :: Next Thread 
East98 is not online. East98
Joined: 17 Jun 2012
Total Posts: 418
26 Jul 2017 02:27 PM
Is it possible? For example lets say youre iterating over a table which contains only tables which contain data and you want to remove one. It would be set up something like this:

for at,tab in pairs(tables) do
if invalid(tab) --[[Function which decides if the table should stay--]] then
remove(tables,at)
end
end

However this would not work because after you remove the first table, the ordereing of the tables after will be thrown off. (Say you remove the table at position 2, Now the tables that was at position 3 shifts to position 2 and now if you try to remove the table at position 3 youre actually removing the table that was at position 4)

Hope this is making sense...

I realize you could iterate the tables backwards starting with the highest index and checking if the table is valid but youd still be using the table.remove() function. Im not that familiar with metatables and metafunctions but is there some way you could rig that up so that if you call a metafunction it 'destroys' its parent table?

--East98
Report Abuse
systematicaddict is not online. systematicaddict
Joined: 13 Jul 2012
Total Posts: 4188
26 Jul 2017 02:29 PM
table[1] = {}
Report Abuse
East98 is not online. East98
Joined: 17 Jun 2012
Total Posts: 418
26 Jul 2017 02:36 PM
But the table is still there... That wouldnt remove it, it would jut change it to a blank table
Report Abuse
LaeMVP is online. LaeMVP
Joined: 24 Jun 2013
Total Posts: 4416
26 Jul 2017 02:37 PM
Array[Key] = nil
Report Abuse
systematicaddict is not online. systematicaddict
Joined: 13 Jul 2012
Total Posts: 4188
26 Jul 2017 02:38 PM
I thought you didn't want to remove it because it would offset everything

Maybe I just didn't read the whole post
Report Abuse
East98 is not online. East98
Joined: 17 Jun 2012
Total Posts: 418
26 Jul 2017 02:41 PM
Yeah probly just bad wording on my part... I guess the problem lies more in the way i iterate the table. Im trying to run a segment of code once for every table within the table and if a value a table is false, delete the table from the bigger one.
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