Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat
return multiple class variables - Gideros Forum

return multiple class variables

MoKaLuxMoKaLux Member
edited September 30 in General questions
I don't understand why this doesn't work :(
TextIconX = Core.class(Sprite)
 
function TextIconX:init(xparams)
	local params = xparams or {}
	params.tex = xparams.tex or "life.png"
	params.text = xparams.text or "xxx"
	--
	local ico = Bitmap.new(Texture.new(params.tex))
	local tf = TextField.new(nil, params.text)
	tf:setPosition(ico:getX(), ico:getY())
	self:addChild(ico)
	self:addChild(tf)
	--
	return ico, tf
end
Then in another class I call:
local ico, tf = TextIconX.new(
	{
		tex="life.png", text=0
	}
)
print(ico, tf) --  *** table: 032F9230	nil ***
Why tf is nil please ???
my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
Tagged:

Comments

Sign In or Register to comment.