[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Adding module+DLL to Lua for Windows (LfW)
- From: Roberto Ierusalimschy <roberto@...>
- Date: Thu, 10 Dec 2009 15:50:10 -0200
> What I would like to see (and experimented with once) is for Lua to load
> the Lua module and call the luaopen_ function by passing in a structure
> of pointers to all the exported Lua functions.
>
> struct lua_Exports
> {
> ...
> void (*lua_pushvalue) (lua_State *L, int idx);
> };
>
> int luaopen_mymodule(lua_State *L, lua_Exports *exports);
>
> A helper function called by luaopen_mymodule could be made available to
> expand that structure into global variables:
>
> [...]
A variation of that idea is to have lua_Exports accessible via
lua_State, so that it does not need to be passed as an extra argument to
luaopen. (E.g., it may be the first pointer in lua_State.)
Do you know the performance impact of this approach?
-- Roberto