lua-users home
lua-l archive

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



tab={}
tab[ MY_GUI_EVENT ]= do my_event_handling_code end

For just calling blah() one would obviously not use/need/benefit from this.

Or:
switch( cond ) {
	['a']= do ..cmds for a.. end,
	['b']= do ..cmds for b.. end,
}

The switch implementation is just a Lua function (ask if interested, not really relevant here)


Karel Tuma kirjoitti 25.10.2006 kello 1.00:

hi,

tab={}
tab[do() blah() end] = true

breaks. as well as binary operators (it's perfectly legal
to append function body in lua .. sometimes ;)
different approach of trying to detect 'in' and 'while' statement
context may work either.
(neither method is much accurate though)

//kt

On Tue, Oct 24, 2006 at 10:41:46PM +0200, Asko Kauppi wrote:

Took my dip into the Wonderful World of token filters.  Veeery lua-
ish, indeed.

May I suggest using .lhf for filter files?  ;)   For Lua Halfway
Filter, or...


-asko

ps. Is there any way I could wrap-in a function body, when processing
its paramlist, without needing a ')' token to be
inserted after the function?  Guess not. :-?


Luiz Henrique de Figueiredo kirjoitti 24.10.2006 kello 17.57:

Here's my semi-regular posting about erlang style numbers... this
time
as an excuse to play with Luiz' token filter. Below is the code to
support this interesting (to me at least) extension:

See, no need for C hacking! :-) And pretty easy to do it in Lua,
right?
(I'm not blowing my own horn here; just remarking that token
filters can be
a better alternative to hacking the Lua core to add more sugar.)

-- 2#1001 means base "2" numeric constant "1001" or 9 in decimal

Just note that you cannot enforce that the three parts are a single
token,
that is, 2   #   1001 will be accepted as a binary constant. Just
don't
tell your users about it :-)
--lhf