[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: how to load a very large table with more than 2^18 literal strings?
- From: Norman Ramsey <nr@...>
- Date: Fri, 11 Sep 2009 19:23:06 -0400
> > I'm accustomed to use Lua to store persistent data structures on disk.
> > Unfortunately, in my latest venture, I run out of string space. I did
> > a little investigation in the source, and it appears that only 2^18
> > literal constants may appear in any one source file, and this appears
> > to be a hard limit built into the bytecode format.
>
> The usual solution for this is to divide your data into functions because
> the limit is per function. This has been discussed before:
> http://lua-users.org/lists/lua-l/2008-02/msg00298.html
Thanks Luiz for this pointer. I wish I had your memory.
I have some generic code that writes any tree-like Lua table
containing only strings, numbers, Booleans, and other tables.
I will have to see if I can adapt it to this purpose without
disrupting things too much. I would prefer to write large table
literals than to populate tables by individual assignment, since I
don't want to pay the costs for growth.
If I get any decent code, I will post it.
Norman
P.S. Am I thinking that the table literal
{ name = 'Ramsey', age = 47 }
contains *four* constants that count against the limit?