lua-users home
lua-l archive

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

On Thu, 2004-11-04 at 18:15 +0000, Daniel Silverstone wrote:
> Another alternative if you're worried is to do this:

Or, as I remembered after I hit 'Send' -- play with the __metatable
property of metatables.

Lua 5.0.2  Copyright (C) 1994-2004 Tecgraf, PUC-Rio
> mt={__metatable="No, Go away"}
> t={}
> setmetatable(t,mt)
> =getmetatable(t)
No, Go away
> mt2={}
> setmetatable(t,mt2)
stdin:1: cannot change a protected metatable
stack traceback:
        [C]: in function `setmetatable'
        stdin:1: in main chunk
        [C]: ?


Daniel Silverstone               
PGP mail accepted and encouraged.            Key Id: 2BC8 4016 2068 7895