lua-users home
lua-l archive

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

> 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