lua-users home
lua-l archive

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


On 8/16/05, Wim Couwenberg wrote:
>   1.a  The lua part in itself is *not* a module so should not be
>        loaded through "require".  (It is a "private" script.)
> 
>   1.b  The entry point in the C module that gets called by require
>        does not know the path from which it could luaL_loadfile the
>        Lua script.
> 
Solutions a) if you know the name of a loaded DLL (e.g. x.dll) you can get
its handle with GetModuleHandle() b) if you have its handle you can get
its fullpath with GetModulefileName()
The package metatable keeps list of the module handles in the
registry.
The problem with storing load paths is that they need to be absolute.
THis can be done on Windows and on *nix. 
If you place your Lua  code in a directory relative to the DLL, knowing
where your Lua source is present no problem (in w6).

David B