[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Access From Inside Modules
- From: Tomas <tomas@...>
- Date: Sat, 22 Jul 2006 10:49:12 -0300 (BRT)
Hi Stefan
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?
This is correct. You could put together all globals with
something like:
local assert, ipairs, type = assert, iparis, type
Which could became a long line. You could also use:
local _G = _G
And qualify all globals in your program: _G.ipairs. I think
what you're looking for is an automatic "global-to-local" initializer,
isn't it? I'm sorry but this is not available... Maybe in a next version
we could have a syntatic sugar for that like:
localimport assert, ipairs, type
If we could find a good name for the keyword...
Tomas