lua-users home
lua-l archive

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


>Is this correct that one cannot override the default meta-behavior of all newly created tables in Lua 5? I know it is possible in Lua 4.

Yes, that's right. But I think the restriction that only tagged tables could
have tag methods was already in some version of 4.1, before we turned to 5.0.

A slightly inconvenient solution in 5.0 is to use a function to create tables:

	function NEW(t)
		return setmetatable({}, YOUR-CHOICE-HERE)
	end

	a=NEW{}
	...

--lhf