lua-users home
lua-l archive

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



Sebastian Rohde wrote:

Does anybody know something about this? Or did I miss something in the
documentation?

I wrote:
While working on our lua_State serialization I found that lua tables seem
to have a metatable even if it seems that none has been set by the user or
by our code. Is that correct?
do you have an example because I don't see when It can happen instead when you specify
explicity the metatable in lua or in C

t={}
=getmetatable(t)
nil

So In lua to specify the metatable

t.mt={}
setmetatable(t,t.mt)
=getmetatable(t)
table: 0x8619270


And in C

UserData *a = (UserData *)lua_newuserdata(L, sizeof(UserData)); -- a table
luaL_newmetatable(L, "SomeName");
lua_setmetatable(L,-2);



Don't know if it helps...

dh.

Can this metatable be safely ignored and how can I distinguish this
metatable from user defined to ignore it during serialization? (And why did this metatable not have this standard metatable?)


begin:vcard
fn:David HERVIOU
n:HERVIOU;David
org;quoted-printable:Ecole Nationale d'Ing=C3=A9nieurs de Brest
adr;quoted-printable;dom:BP 38;;25, rue Claude Chappe;Plouzan=C3=A9;France;29280
email;internet:herviou@enib.fr
title;quoted-printable:Centre Europ=C3=A9en de R=C3=A9alit=C3=A9 Virtuelle
tel;work:+33 (0)2 98 05 89 45
tel;fax:+33 (0)2 98 05 89 79
note;quoted-printable:Doctorant En Informatique au laboratoire LISyC (Laboratoire d'Informatiqu=
	e des Syst=C3=A8mes Complexes) dans le cadre du projet AR=C3=A9Vi.
url:http://www.cerv.fr/~herviou
version:2.1
end:vcard