lua-users home
lua-l archive

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


On Tue, May 11, 2010 at 12:53 PM, HyperHacker <hyperhacker@gmail.com> wrote:
> I'm sure I've heard it repeatedly stated that vararg would change in
> 5.2 in this very list. Also:
>> function f(x,...) print(#...) end
>> f(1,2,3,4)
> stdin:1: attempt to get length of a number value
> It doesn't work, because "#..." expands to "#2,3,4" which doesn't make sense.

The error message was pretty clear. Try this:

batrick@neverwinter:~$ lua
Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
> function f(...) print(#...) end
> f("foo")
3

-- 
- Patrick Donnelly