lua-users home
lua-l archive

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

On Fri, 10 Nov 2000, John Belmonte wrote:

> Hello,
> I'm wondering if a library that uses such general global names as "close"
> would conflict too easily with other Lua programs.
> A limited solution would be to make lua_socklibopen() take an optional table
> name to insert the functions into instead of the global scope.  But this
> breaks down as soon as some other library depends on socklib and expects the
> names to be in a certain place (global).
> Not a simple issue, but I think it will have to be addressed eventually as
> more common libraries are created for Lua.
> -John

Supplying a table in which to put all globals sounds like a useful
solution. If that table was also stored in a known global variable, such
as 'sockLib' as the default, other libraries could depend on it without
cluttering up the global namespace. Individual users could easily shift
those table elements to the global namespace (or just shift the ones they
use) if that was more convienent. 

This could, in fact, be used as a sort of semi-standard way to handle
libraries. There are already many mechanisms in place to make this work


  - Tom Wrensch