lua-users home
lua-l archive

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


2012/11/9 Richter, Jörg <Joerg.Richter@pdv-fs.de>:
> Try this script (in Lua 5.1.4):
>
> local t = {}
> for i = 1,2^18 do
>   t[#t+1] = '(function() return '..i..' end)();\n'
> end
> print( loadstring( table.concat( t ) ) )
>
> I always thought that the constant table limit is per function. But why do I get this output:
>     nil     constant table overflow
>
> I think I am missing something here.

It's not about the constant inside the sub-functions, you get the same
results with:

local t = {}
for i = 1,2^18 do
  t[#t+1] = '(function() end)();\n'
end
print( loadstring( table.concat( t ) ) )