[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: switch statement
- From: Supratik Champati <champati@...>
- Date: Tue, 08 Dec 1998 02:44:04 -0500
> The "efficient" way in Lua is to *index* a table of functions. something like:
>
> action={
> [1] = function (x) B1 end,
> [2] = function (x) B2 end,
> ["nop"] = function (x) B3 end,
> ["my name"] = function (x) B4 end,
> }
>
> then do
>
> action[x](x)
The above solution will actually work fine for me.
Thanks a lot.
Also I was wondering if someone has already written (and would
graciously like to share)
some kind of lua add-on that would enable us to dynamically load object
files.
The reason I need this is that some functions are too time consuming to
be implemented
in lua hence it would be nice to be able to write them in c/c++ and
somehow make the
compiled object "dynamically" visible to lua.