Skip to content

Instantly share code, notes, and snippets.

@nefftd
Created January 10, 2015 22:49
Show Gist options
  • Select an option

  • Save nefftd/a7f1bdc3e7d591c5002f to your computer and use it in GitHub Desktop.

Select an option

Save nefftd/a7f1bdc3e7d591c5002f to your computer and use it in GitHub Desktop.
C:\Users\Neffi
λ lua
Lua 5.2.3 Copyright (C) 1994-2013 Lua.org, PUC-Rio
> local t={}; for i = 1,950000 do t[i]='a' end; local tprime = table.pack(table.unpack(t,1,#t/2)); print(#tprime)
475000
> local t={}; for i = 1,1000000 do t[i]='a' end; local tprime = table.pack(table.unpack(t,1,#t/2)); print(#tprime)
500000
> local t={}; for i = 1,1200000 do t[i]='a' end; local tprime = table.pack(table.unpack(t,1,#t/2)); print(#tprime)
600000
> local t={}; for i = 1,2200000 do t[i]='a' end; local tprime = table.pack(table.unpack(t,1,#t/2)); print(#tprime)
stdin:1: too many results to unpack
stack traceback:
[C]: in function 'unpack'
stdin:1: in main chunk
[C]: in ?
>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment