lua-users home
lua-l archive

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


Yes and yes.

Try it out this way:

local table = {}
table.a = 1
second = table
print(table.a)
print(second.a)
-- both print 1

function table.test() print("Moo!") end

table.test()
second.test()
-- both print Moo!

On Fri, 18 Jun 2004 16:14:50 +0200, Maxime Petazzoni
<maxime.petazzoni@bulix.org> wrote:
> 
> Hi,
> 
> I have two little questions that I hope you'll be able to answer :
> 
> - When a create an table and then make a copy of it :
> 
> local table = { }
> second = table
> 
> Does a change on table will be propagated to second ?
> 
> - When I see this :
> 
> local table = { }
> 
> function table.test ()
>  print("Mooh !")
> end
> 
> Does it creates a function test inside the table 'table' ?
> 
> Thanks,
> - Sam
> --
> Maxime Petazzoni - sam@bulix.org - http://www.bulix.org
> Gobelins' core team leader       - http://gobelins.nekeme.net
> GPG fingerprint: D694 DAB9 8F4E 68A8 4C17  F011 ECAB 0E7B 83E6 AE0D
> Jabber: sam@jabber.dk ICQ: 100551837 AIM: maximepetazzoni
> 
> 
> 
> signature.asc - 1K
>