lua-users home
lua-l archive

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


Thanks - the old nil value in table gotcha!

steve d.

On Mon, Apr 6, 2009 at 5:24 PM, Thomas Harning Jr. <harningt@gmail.com> wrote:
> On Mon, Apr 6, 2009 at 11:16 AM, Peter Cawley <lua@corsix.org> wrote:
>> The following examples do not work as I'd expect them to:
>>
>> bbind (print,nil) () --> nothing ; should be nil?
>> bbind (print,nil,_1) (1) --> nothing; should be nil 1?
>> bbind (print,_3,_3) (1,2,3) --> table table; should be 3  3?
> This could be fixed by updating the wrapping of var-args from:
> local args = {...}
> to
> local args = {n = select('#', ...), ...}
>
> and update iteration:
> for i, v in ipairs(args) ....
>
> to
>
> for i = 1, args.n do
>  local v = args[i]
> ..
> --
> Thomas Harning Jr.
>