Hallo,
On Tue, Mar 24, 2009 at 4:38 PM, Marc Feeley feeley@iro.umontreal.ca wrote:
- How are modules identified? In other words what is the key that is
used to access the previously loaded module table? One simple approach would be to use the filename as the key, but this does not work in a static linking model where the modules have been linked with the executable (and the executable is meant to be installed on a different machine). So what is a good way to identify modules unambiguously? A hash? A user supplied "module id"? Should modules have version numbers?
Lua's REQUIRE takes a string as parameter. It first looks for the module in a "preload" table using the string as key, which is how statically linked modules register themselves. If not found there, it searches the module in the file system using the string as a file name. Here is a link for the relevant documentation:
http://www.lua.org/manual/5.1/manual.html#pdf-require
Cheers,