table.unpack() compatibility

Mar 5, 2015 at 2:35 AM
table.unpack() is not currently compatible with the Lua standard. Consider the following code:
local t = {7}
local u = table.unpack(t,1,1)

if u == nil then
 print('unpack is nil')
end

print(u)
In NeoLua, unpack returns nil. In "http://www.lua.org/cgi-bin/demo" unpack returns 7. NeoLua is using the end argument as exclusive while the standard uses the end argument as inclusive.

The workaround is to use "table.unpack(t,1,2)".
Coordinator
Mar 5, 2015 at 10:33 AM
I do not like one based arrays :).

Fix on github

Is this ok?
Mar 5, 2015 at 5:06 PM
Yes, unpack works fine now.