Answers for "what does nill mean in lua"

Lua
1

what does nill mean in lua

In Lua, nil is used to represent non-existence or nothingness. It’s frequently used to remove a value in a table or destroy a variable in a script. For instance:-- Create a new brick
local part = Instance.new("Part")
-- Parent new part to the workspace, making it viewable
part.Parent = workspace 
wait(1)
-- Remove the part from view, but not from memory
part.Parent = nil
wait(1)
-- Part still exists because it's referenced by the variable 'part', so it can be returned to view
part.Parent = workspace 
wait(1)
-- Remove the part from view again
part.Parent = nil
-- Clear part reference so it gets picked up by the garbage collector
part = nil
Posted by: Guest on June-09-2020

Browse Popular Code Answers by Language