lua-users home
lua-l archive

Re: Embbeding LUA/multithread

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


> Since now I'm creating a new state for each script. Then I
> register the API functions on EVERY state, and launch the
> script. As I create a new state for every script running, I
> have to register ALL the API functions (near 300) for each
> script run and I can't use global variables. Loosing global
> variables are not a problem, but I don't like to register
> the functions each time.
I've posted one or more solutions for this. See the archives.
Here is a simple solution:
 Define a "getglobal" tag method that tries to match the name to one of
 your 300 API functions (if they all begin with the same prefix, this is
 easier). If there is a match, return the API function as a C function
 from the "getglobal" tag method.
--lhf

AltStyle によって変換されたページ (->オリジナル) /