[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: catching lua variable set and get value
- From: "Ivano Coltellacci" <ivano.coltellacci@...>
- Date: Thu, 26 Jun 2003 01:22:52 +0200
> -----Message d'origine-----
> De : lua-bounces@bazar2.conectiva.com.br
> [mailto:lua-bounces@bazar2.conectiva.com.br]De la part de Luiz Henrique
> de Figueiredo
> Envoyé : mercredi 25 juin 2003 07:26
> À : lua@bazar2.conectiva.com.br
> Objet : Re: catching lua variable set and get value
>
>
> >I'd like to be able to intercept set/get of value to lua varibales.
>
> Try the code below. Instead printing, call your C functions.
> --lhf
>
> do
> local function set(t,name,value)
> print("set",name,value)
> end
>
> local function get(t,name)
> print("get",name)
> return name
> end
>
> setmetatable(getfenv(),{__index=get,__newindex=set})
> end
>
> -- test it...
> sym = 10
> a = sym
Thank You..
I was missunderstanding the __index and __newindex events
tags.
Using your and Dimitris suggestion I get what I was looking for.. :)