lua-users home
lua-l archive

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


It was thus said that the Great hz . once stated:
> hi,
> 
> Is there a way to init table field as:
> 
> tbl = {
>  a = ‘aaa’,
>  b = a,
> }
> 
> where b is inited as ‘aaa’?
> 
> Or what’s the most simple approach to do this.

  Umm ...

	tbl =
	{
	  a = 'aaa'
	}

	tbl.b = tbl.a -- ?

	tbl = {}
	tbl.a = 'aaa'
	tbl.b = tbl.a -- ?

  -spc