lua-users home
lua-l archive

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

I understand the theoretical arguments for treating strings as values with respect to weak tables, but are there any practical benefits? It would seem, for example, to get in the way of caching the results of file reads a la:

	fileCache = setmetatable( { }, {
		__mode = 'kv',
		__index = function( t, k )
			local v
			local f = k )
			if f then
				v = f:read( "*a" )
				t[ k ] = v
			return v
		end } )