Page 1 of 1

why give this error

Posted: Mon Nov 22, 2021 7:18 pm
by davoodice2

Code: Select all

function BLABLA:OnMouseDown(moho, mouseEvent)
	local layersCount = 0
	repeat
		local layer1 = moho.document:LayerByAbsoluteID(layersCount)
		if layer1 then
			layersCount = layersCount + 1
			print( layer1:Parent():Name() )	
		end
	until not layer1
	...
line 256 attemt to tindex a nil value :| :? :? :( :(
parent is nil :roll:

Re: why give this error

Posted: Mon Nov 22, 2021 7:32 pm
by synthsin75
Since you're looping through every layer in the document, top level layers do not have parents.

Re: why give this error

Posted: Mon Nov 22, 2021 10:12 pm
by davoodice2
synthsin75 wrote: Mon Nov 22, 2021 7:32 pm Since you're looping through every layer in the document, top level layers do not have parents.
thanks