lua-users home
lua-l archive

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


On Sun, Oct 17, 2010 at 03:47, Luis Carvalho <lexcarvalho@gmail.com> wrote:
>> Apologies for a lazy question, I have not done my own homework.

>> I've got a large file  (3M entries, 250 MB) with data.
>> Each entry is one line with a small Lua table:

>> { foo = 1; bar = 2; baz = 'text' };

> I'm almost sure I'm missing something here, but since each line is a table, is
> there anything wrong with this?

> local load_huge_table_list = function (filename)
>  local f = assert(io.open(filename))
>  local s = "return {" .. f:read"*a" .. "}"
>  f:close()
>  return assert(loadstring(s))()
> end

There is a limit of constants per chunk, you'll hit it.

Alexander.