lua-users home
lua-l archive

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


This solution will require manual sync of names in multiple tables, can
get quite complex with several levels of hierarchy in sub tables.
Plus it add`s a runtime overhead for accessing this table, which is
better to avoid in such cases.

-----Original Message-----
From: Jamie Webb [mailto:j@jmawebb.cjb.net] 
Posted At: Friday, November 19, 2004 5:31 PM
Posted To: LUA
Conversation: (Feature Request) Custom Attributes. [bcc]
Subject: Re: (Feature Request) Custom Attributes. [bcc]

On Fri, Nov 19, 2004 at 04:22:41PM +0100, Roland Illig wrote:
> Timur Davidenko wrote:
> >Table = {
> >            <UIWidget="slider" UIMin=0 UIMax=100>
> >            Radius = 10,
...
> >}
> 
> Table = {
>   Radius = {
>     attr = { UIWidget = "slider", UIMin = 0, UIMax = 100 },
>     value = 10
>   },
...
> }
> 
> Something like that?

Or, if your data structure will have multiple instances, use a
separate table for attributes:

TableAttrs = {
	Radius = { UIWidget = "slider", UIMin = 0, UIMax = 100 },
	...
}

Table = {
	-- Could reference the attributes table like this, or put the
	-- attributes in the metatable, etc.
	attr = TableAttrs,
	Radius = 10,
	...
}


____
This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. Crytek GmbH - http://www.crytek.com