lua-users home
lua-l archive

Re: Read-Only Tables Patch

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


Another issue with this approach is list iteration:
	mytab = {}
	mt = { __index = someCfunction }
	setmetatable(mytab, mt)
	local i, v = next(mytab, nil)
	while i do
		print(i .. " : " .. v)
		i, v = next(mytab, i)
	end
The above will never print anything as 'mytab' is empty.
The other goal is transparency. The patch provides this.
Thanks for the feedback,
Michael Grubb
On Nov 13, 2006, at 5:10 PM, Luiz Henrique de Figueiredo wrote:
This metamethod can also save the values in the table, so that it will
act as a cache for C values (which may or may not be desirable).
This would allow modifying the cached values.
Like I said, it may not be what you want but it's convenient
when it makes sense.
--lhf

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