Sprite:resolveStyle

From GiderosMobile

Available since: Gideros 2022.6
Class: Sprite

Description

Resolves a style reference from the given style table or the one attached to the sprite.

(vary) = Sprite:resolveStyle(reference,style)

Parameters

reference: (String) the style reference to retrieve from the styling table
style: (table) the styling table

Return values

Returns (vary) the style reference value(s)

Example

local style={
	cellColor=vector(1,0,0,1) --cellColor is Red initially
}
for i=1,10 do
	local p=Pixel.new(vector(0,0,0,0),10,10)	
	p:setX((i-1)*15)
	p:setStyle(style)
	p:setColor("cellColor")
	stage:addChild(p)
end
Core.asyncCall(function()
	Core.yield(3) --Wait 3s
	style.cellColor=vector(0,1,0,1) --Set cellColor to green
	for i=1,10 do
		stage:getChildAt(i):setStyle(style)
		print(stage:getChildAt(i):resolveStyle("cellColor",style))
	end
end)

See also

Sprite:setStyle