lua-users home
lua-l archive

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


	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