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: Is there any way to get nil parented objects

Previous Thread :: Next Thread 
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
13 Feb 2015 10:54 PM
An object that never had a parent, its been nil since it was created (So I can't use childRemoving or anything)

I don't think it has any references (None that I can use at least) so it will get collected by the garbage collector, does that help?
Report Abuse
nicemike40 is not online. nicemike40
Joined: 19 Dec 2008
Total Posts: 1814
13 Feb 2015 10:55 PM
If it doesn't have any references then by definition you cannot get a reference to it. So no.

~Upload code to codepad-dot-org with Lua syntax highlighting to preserve indentation and make it easier to read!~
Report Abuse
JimmyChance is not online. JimmyChance
Joined: 01 Nov 2009
Total Posts: 3681
13 Feb 2015 10:57 PM
Oh, never knew that. So any instances without a reference are GC'd?
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
13 Feb 2015 10:57 PM
I thought maybe there would be a way to get an object that is being collected by the garbage collecter
Report Abuse
nicemike40 is not online. nicemike40
Joined: 19 Dec 2008
Total Posts: 1814
13 Feb 2015 11:06 PM
In regular Lua you could stop the garbagecollector or get the memory used and change how long steps will last/how big they are, but no way to get back lost references :/

~Upload code to codepad-dot-org with Lua syntax highlighting to preserve indentation and make it easier to read!~
Report Abuse
nicemike40 is not online. nicemike40
Joined: 19 Dec 2008
Total Posts: 1814
13 Feb 2015 11:07 PM
Welll you could use weak tables to get things that are gonna be collected by the garbagecollector, but you don't really have much control over that I don't think. Could try it, though.

~Upload code to codepad-dot-org with Lua syntax highlighting to preserve indentation and make it easier to read!~
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
13 Feb 2015 11:10 PM
If you have no reference to it, there is no way to get a reference to it in plain Lua. I don't see how having a weak table will help without him actually adding it to the table which, if he could do that, means he has a reference.
Report Abuse
nicemike40 is not online. nicemike40
Joined: 19 Dec 2008
Total Posts: 1814
13 Feb 2015 11:12 PM
He could have the only (weak) reference be in the table. It's stupid and doesn't have a use that I can see, but I mean I'm just throwing out things.

~Upload code to codepad-dot-org with Lua syntax highlighting to preserve indentation and make it easier to read!~
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
13 Feb 2015 11:28 PM
'I don't think it has any references (None that I can use at least)'
How would he get that reference if he says he has no way to... You can't just ask the garbage collector for a list of all the item is plans to clean up next cycle
Report Abuse
DrMathematica is not online. DrMathematica
Joined: 29 Aug 2008
Total Posts: 27268
13 Feb 2015 11:37 PM
"Welll you could use weak tables to get things that are gonna be collected by the garbagecollector, but you don't really have much control over that I don't think. Could try it, though."

No, you cannot. Weak tables and references are not understood very well by the Lua community on ROBLOX, so it is troublesome when someone tries to use the term.... incorrectly.

You can't get the anything from a weak table, because a weak table is, for instance, something that has been overwritten.

X = {};
key = {};
X[key] = 2;
key = {};
X[key] = 1;

Both 'key' and 'X[key]' are a weak table and weak reference. The first reference to 'key' in table X is overwritten and set to 1. The original reference still exists in Lua's memory as a weak reference, but not for long. The GC will pick it up eventually.

There is no way to use these weak features to the need of this thread.
Report Abuse
nicemike40 is not online. nicemike40
Joined: 19 Dec 2008
Total Posts: 1814
13 Feb 2015 11:44 PM
I appreciate you explaining that to me, but I also don't like your use of snarky ellipses so I hope your slinky gets tangled

~Upload code to codepad-dot-org with Lua syntax highlighting to preserve indentation and make it easier to read!~
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