lua-users home
lua-l archive

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


It works for j = 9998, but don't for 9999 ou greater, and doen't matter the initial value, like 0, -6 or 1000.

It's a kind of limit with Unpack?

[]'s,

Marco Antonio Abreu
IT Quality Systems
mabreu@itquality.com.br
http://www.itquality.com.br



Patrick Donnelly wrote:
Lua 5.1.3  Copyright (C) 1994-2008 Lua.org, PUC-Rio
j = 1e4
co = coroutine.create(function() t = {} for i = 1, j do t[i] = i end return unpack(t) end)
print(coroutine.resume(co))
Segmentation fault

this appears to only happen in Lua 5.1.3, 5.1.2 correctly catches this:

Lua 5.1.2  Copyright (C) 1994-2007 Lua.org, PUC-Rio
j = 1e4
co = coroutine.create(function() t = {} for i = 1, j do t[i] = i end return unpack(t) end)
print(coroutine.resume(co))
false   stdin:1: stack overflow (table too big to unpack)

You may need to play with values for 'j'.