Re: event handler for table initialization
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: event handler for table initialization
- From: Romulo <romuloab@...>
- Date: 2010年9月21日 16:27:53 -0300
On Tue, Sep 21, 2010 at 4:15 PM, Nilson <nilson.brazil@gmail.com> wrote:
> function enum{arg} -- <--- NEW: language change: using { } instead
> of ( ) meaning a table event handler
>
> local evt = table.getevent -- NEW function to get the current event
>
> if evt ==nil then
> -- normal processing (usually an after processing)
> return arg
>
> elseif evt.type = 'begin' then -- begin of table creation
> old_mt = getmetatable(_G);
> setmetatable(_G,enum_mt) -- installs unquoted string
>
> table.listen('e'); -- NEW: informs what to listen. here, listens
> to end events (default behaviour)
>
> elseif evt.type = 'end' then -- end of table creation
> setmetatable(old_mt) -- resume the old one
Perhaps you should look at the token filter patch.
--rb