Difference between revisions of "Importing Library Names Into Global Environment"

From OpenEUO
Jump to: navigation, search
(See Also)
(mention new matching metamethod)
 
Line 4: Line 4:
  
 
The library names have been selected to minimize interference with other libraries and lua itself, however, importing them can result in undetectable errors of usage such as having them later accidentally or spuriously redefined.
 
The library names have been selected to minimize interference with other libraries and lua itself, however, importing them can result in undetectable errors of usage such as having them later accidentally or spuriously redefined.
 +
 +
Additionally, in version 0.06 forward in the library, actual interface table members can be specified in any case desired, and partially specified names are selected by a matching metamethod, e.g. sl.sLiM() matches sl.slimport() and sl.FILE() matches sl.file(). This functionality cannot be duplicated in the _G environment; another reason avoid importing library names.
  
 
== See Also ==
 
== See Also ==

Latest revision as of 16:44, 30 November 2010

All top level library methods can be imported into the global environment _G, though this usage is strongly discouraged, especially for authors of intermediate libraries.

 sl.slimport('lower'|'upper'|'camel')

The library names have been selected to minimize interference with other libraries and lua itself, however, importing them can result in undetectable errors of usage such as having them later accidentally or spuriously redefined.

Additionally, in version 0.06 forward in the library, actual interface table members can be specified in any case desired, and partially specified names are selected by a matching metamethod, e.g. sl.sLiM() matches sl.slimport() and sl.FILE() matches sl.file(). This functionality cannot be duplicated in the _G environment; another reason avoid importing library names.

See Also