Is this local?

I have been thinking today about global and locals. I get locals are better but have some questions about locals.

Is the example variable local or global?

– 1

local example = 0 

example = nil

example  = 0 

------------------------ separate code

–2

local example = display.newRect( 0, 0, 20, 20 )

display.remove(example)

example  = 

------------------------ separate code

–3

local example = display.newRect( 0, 0, 20, 20 )

display.remove(example)

example  =  display.newRect( 0, 0, 20, 20 )


What is the best way to clean out a local attribute and keep it a local attribute?

Thanks, 

Scott

You seem to have it. When  your done with “example”, set it to nil.

Rob

Ok, I thought if you nil it the attribute it is completely destroyed and if did set if equal to the attribute that was just destroyed a new global attribute would be created. 

You seem to have it. When  your done with “example”, set it to nil.

Rob

Ok, I thought if you nil it the attribute it is completely destroyed and if did set if equal to the attribute that was just destroyed a new global attribute would be created.