lua-users home
lua-l archive

Re: Load large amount of data fast

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


On Oct 17, 2010, at 3:43 AM, Petite Abeille wrote:
> local aContent = assert( aFile:read( '*a' ) )
> local aChunk = assert( load( aContent ) )
Perhaps of interest as well, in 5.2, the load() function accepts an iterator, so the above can be rewritten as follow:
local aChunk = assert( load( function() return aFile:read( 65536 ) end ) )
This avoids having to read the entire file at once.

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