lua-users home
lua-l archive

Access From Inside Modules

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


To make globals accessible inside a module I can write
 local string = require "string"
 local table = require "table"
 module(...)
However, standard functions such as 'ipairs' will not be "visible." I could write
 module(..., package.seeall)
but then _all_ globals will be visible inside the module, not just the ones I want and have defined with the 'local xxx = require "xxx"' expressions, hence undermining my intention of selective "imports" for my module.
I could also write
 local string = require "string"
 local table = require "table"
 local ipairs = ipairs
 module(...)
but this way I seem to need a definition for _each_ single standard function such as 'ipairs' -- is this correct or am I missing something?
Thanks
- Stefan
--
Stefan Brantschen
sbr@acm.org

AltStyle によって変換されたページ (->オリジナル) /