some scripting stuffs
#3
Wrong game.

[lua]
p = create("Box") -- Create a new box
p.Parent = game.World -- The part (a grey box, by default) has a parent, the world
sleep(1)
p.Parent = nil -- The part now has no parent (and so it disappears from view, but not from memory).
sleep(1)
p.Parent = game.World -- part still exists because it is referenced by the variable 'p'
sleep(1)
p.Parent = nil -- part disappears again (it has no parent)
p = nil -- part is no longer referenced by anything, so it gets picked up by the garbagecollector
[/lua]
Reply


Messages In This Thread
some scripting stuffs - by -_- - 04-02-2011, 11:12 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)