lua-users home
lua-l archive

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


[...]
>   m = {__index=ci, __newindex=cn}
> 
>   setmetatable(_G,m)
> 
> The result of this is that if we say:
>      abc = 123
> 
> then the global table's key "abc" will be store the 123 value, whereas:
>     xyzzy = 456
> 
> will not affect the global table, but will instead call "cput(456)".
Not too
> inefficient (despite affecting the whole global table _G) as you
only trap
> accesses to globals that are undefined.
> 
> Is that the sort of thing you're after?

Yep.That was an alternative.But I was hoping on getting away with
using full userdata to store structs with all info on a
cvar(pointer,flags etc.) and keep those in the global table w/o having
to use multiple tables.But that's no big deal.I did like lua4 a little
better though.Although getting rid of tags and doing everything with
tables is a good move some more methods would really help out.Also
(this just came to me) wouldn't it be better to get rid of full and
light userdata by just making 'light' userdata userdata of size 0?That
would unify things.
Last but not least I want to thank you all for those long replies with
code and all.I hope don't have any more trouble.

Dimitris