lua-users home
lua-l archive

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


My proposal was just to simplify module creation syntax.

Anyway such a "base" table is straightforward to create:
	base = {
		_VERSION = _VERSION;
		assert = assert;
		collectgarbage = collectgarbage;
		dofile = dofile;
		error = error;
		getfenv = getfenv;
		getmetatable = getmetatable;
		ipairs = ipairs;
		load = load;
		loadfile = loadfile;
		loadstring = loadstring;
		module = module;
		next = next;
		pairs = pairs;
		pcall = pcall;
		print = print;
		rawequal = rawequal;
		rawget = rawget;
		rawset = rawset;
		require = require;
		select = select;
		setfenv = setfenv;
		setmetatable = setmetatable;
		tonumber = tonumber;
		tostring = tostring;
		type = type;
		unpack = unpack;
		xpcall = xpcall;
	}
List of functions comes from the manual index. I just removed _G.


-----Message d'origine-----
De : lua-bounces@bazar2.conectiva.com.br [mailto:lua-bounces@bazar2.conectiva.com.br] De la part de Stefan Brantschen
Envoyé : 24 juillet 2006 14:05
À : Lua list
Objet : Re: Access From Inside Modules

Jerome -

On 24 Jul 2006, at 16:42, Jerome Vuarand wrote:

> module("foo", package.see{"base", "string", "table"})
>
> You would just have to define that "see" function, it shouldn't be 
> complicated.

Hmm. Maybe I am missing your point, but: if there _were_ a table "base" with all the basic functions, as your proposal seems to imply, I'd simply write

  local table = require "table"
  local string = require "string"
  local base = require "base"

and refer to ipairs using 'base.ipairs()'.

Do I miss anything?

Best
- Stefan