[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Load large amount of data fast
- From: Petite Abeille <petite_abeille@...>
- Date: Sun, 17 Oct 2010 16:24:29 +0200
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.