lua-users home
lua-l archive

Using one module's functions from another

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


Another basic 5.1 module question:
Within:
module "a"
how do I use functions from other modules, e.g. string.find &c.? I can do
local string = string
module "a"
but this is rather ugly, especially for functions in the top level, which I then have to treat one at a time:
local require, print = require, print
Also, what if I want to use functions from a module required by the current one, e.g.
local require = require
module "a"
require "b"
b.foo()
? I don't see how I can do a "local b = b" here, as "b" isn't defined before I do 'module "a"' in general. I guess I don't really understand the way that module modifies the environment yet...
--
http://rrt.sc3d.org/ | perfect, a. unsatirizable

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