lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Leigh McRae wrote:

Some people may frown on this, but your sprite's parameter setting methods could each return self
then you could use code like

  self.spBackGround = CreateSprite():setSize(10, 10):setName('MySprite') etc.

Another possibility is to pass a table to CreateSprite with the values e.g.

  self.spBackGround = CreateSprite({Width = 10, Height = 10, Name = 'MySprite'})

Yeah, I need sp after that. The pattern is that I create a sprite to be stored in 'self' and then configure sp with calls. Thanks anyways.

----- Original Message ----- From: "Luiz Henrique de Figueiredo" <lhf@tecgraf.puc-rio.br>
To: "Lua list" <lua@bazar2.conectiva.com.br>
Sent: Thursday, March 08, 2007 12:09 PM
Subject: Re: Assign idiom


local    sp = self.spBackGround = CreateSprite()
sp:setSize( 10, 10 )

If you don't need sp after that, try
CreateSprite():setSize( 10, 10 )