|
Is like a shortcut way to accessing things parented to nil? |
|
|
give me an example, I dont really get what you mean. |
|
|
You use a variable.
local a = workspace.Part
Now when Part is parented to nil, you can retrieve it with the variable 'a'. Note that if an object has no references (So nothing linking to it) it will be cleaned up by the garbage collector. |
|
|
What if I don't have a variable assigned to it in THIS script?
There should be something like
game:GetService("NilService"):GetNilObjects()
XD |
|
lostendJoin Date: 2011-08-21 Post Count: 8265 |
You can't.
local objects=game:GetService('NullService'):GetChildren()
for i=1,#objects do
objects[i].Parent=workspace
end
IMAGINARY CODE :D
But seriously. I really think at this point, it's stupid not to use a variable. |
|
|
If something is being stored in nil, make sure you don't need it by other scripts. If you WILL need it again, shove it into an ____Storage service |
|
|
I'm thinking of making a nil tracker.
_G.Nil = {}
function NilCheck(p)
for I,v in pairs(p:GetChildren()) do
obj.Changed:connect(function()
if obj.Parent == nil then
table.insert(_G.Nil, obj)
elseif obj.Parent ~= nil then
for I,v in pairs(_G.Nil) do
if v == obj then
table.remove(_G.Nil, I)
end
end
end
end)
NilCheck(v)
end
end
game.DescendantAdded:connect(function(d)
d.Changed:connect(function()
if d.Parent == nil then
table.insert(_G.Nil, d.
elseif obj.Parent ~= nil then
for I,v in pairs(_G.Nil) do
if v == d then
table.remove(_G.Nil, I)
end
end
end
end)
Would that work? |
|
vat21sJoin Date: 2010-06-07 Post Count: 2508 |
I'll Give it a test. |
|
vat21sJoin Date: 2010-06-07 Post Count: 2508 |
Had a few errors. Missing 2 brackets and an end. |
|
vat21sJoin Date: 2010-06-07 Post Count: 2508 |
Very strange Indeed, All the parts went byebye but the welds saved... |
|
vat21sJoin Date: 2010-06-07 Post Count: 2508 |
Omg It lives! The Nil-Iverse lives! |
|
|
When something has no references to it, meaning nothing's a parent to it and no scripts have any variables to it, Lua automatically removes it when it does "garbage collection" so it won't be accessible anymore because it will no longer exist. |
|
cornytimeJoin Date: 2013-02-07 Post Count: 3213 |
there's actually some admin scripts that have
--
wait()
script.Parent=nil
--
therefore it wont be deleted and will be permanently there |
|
|
@vat
Was the missing end) the only error?
I am now containing a list of all nils XD |
|
|
Enjoy your memory leak! :D |
|
|
XD, it's the Nil-iverse
Like someone else said.
It contains all things nil lol, now to find out what people actually hide in personal servers... |
|