[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Q on altering the default meta behavior in Lua 5?
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Wed, 22 Jan 2003 01:24:20 -0200
>Is this correct that one cannot override the default meta-behavior of all newly created tables in Lua 5? I know it is possible in Lua 4.
Yes, that's right. But I think the restriction that only tagged tables could
have tag methods was already in some version of 4.1, before we turned to 5.0.
A slightly inconvenient solution in 5.0 is to use a function to create tables:
function NEW(t)
return setmetatable({}, YOUR-CHOICE-HERE)
end
a=NEW{}
...
--lhf