lua-users home
lua-l archive

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


> (hoping the signal/noise is right on this one...:)

Yes, but the addresses confused me. You sent the message to the list and
directly to me. I got only my own copy without noticing the copy to
the list and replied only to you. Follows my reply:


> What was the reason behind making module initialization functions  
> carry the module name(space) anyhow?  I think there is/was some, was  
> it the static building situation (linking a module statically with  
> the main Lua executable)?  Is there any other reason for that behaviour?

No other reason. But the "static building situation" is a very strong
reason by itself. Lua works in several systems that do not support
dynamic linking, and in most systems static linking is *much* faster
than dynamic linking.  The presence of a luaopen_init function is
something you cannot "choose" (without editing a .c source file): either
a module has a luaopen_init function, and then does not work with static
linking, or it does not have that function, and then would not work
renamed.


> With the "defaults to luaopen_init" I think the whole "-" notation  
> could be removed. It sounds potentially hazardous, I won't be able to  
> make a "sdl-mixer" submodule, would I?

No. But the "standard" for modules recommends that you store them in
globals with their names, so any name which is not a valid Lua name is
not recommended anyway.

-- Roberto