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 |
|
|
|
| 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 |
|
|
|
| 13 Feb 2015 10:57 PM |
| Oh, never knew that. So any instances without a reference are GC'd? |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|