I was rather disturbed this afternoon after getting the following error from
lua for the first time:
too many items in a constructor (limit=262143) near `,'
It wasn't the first time I tried to create huge tables in lua as I'm using it
to load various kinds of data I need like images(textures), geometry(models),
audio etc. By diabolical luck (or lack of it) though the biggest thing I had
tried to load so far was a 256x256 RGBA image which has 65536 4-component
pixels for a total of 262144 elements which is *right on* the limit. Trying
to load a 512*512 RGBA texture failed.
Well I say I was disturbed initially because I thought this would easily be
taken care of by just changing some #define constant in the lua sources and
recompiling but I soon discovered that the problem is the size of the
registers in the lua vm so now I've moved on to being quite worried.
The problem is that the constructor opcode uses the Bx register to specify the
total number of elements (I think) which is 18 bits long. I tried making the
B and C registers 25 bits long each which would give me a 50 bit Bx register
(with all the registers being 64 bits wide) but I got a whole bunch of
serious-looking warnings during compile.
Is there anything that can be done to give me bigger constructors, like say at
least 4M elements? I'm really counting on loading data using lua in my
overall design so I'm in really big trouble if this isn't possible.