You can set a variable to nil.
It simply clears the variable.
If that variable was referring to a previously deleted display object, or if it was referring to a table and the object/table has no other references, it can now be garbage collected (different from deletion).
local obj = display.newCircle( 10, 10, 10 ) display.remove( obj ) -- deleted, but remaining stub table can't yet be garbage collected obj = nil -- now garbage collection can free memory associated with stub of obj
local junk = { } junk[1] = { a, b, c } junk[2] = " junk[1] = nil -- Table that was at 1 can now be garbage collected. junk[2] = nil -- String at 2 can now be garbage collected. -- Note: Table junk has no entries, but is still valid. junk = nil -- Now the table can be garbage collected -- Tip,if we skipped prior nil assignments, the table at entry 1 would be -- garbage collected at this point.