lua-users home
lua-l archive

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


On Tue, Dec 08, 1998 at 09:49:14PM -0200, Luiz Henrique de Figueiredo wrote:
> this is where upvalues enter! check this out:
> 
>  function correlate_data(tbl1,tbl2)
>    local output_tbl = {};
> 
>    for(1,2,function (x)			-- use the 'for' *function*
>       %output_tbl[x] = %tbl2[%tbl1[x]];	-- see the upvalues!
>    end);
> 
>    return (output_tbl);			-- no need for parentheses here
>  end
> 
> this should work.

I never did understand how upvalues were supposed to work. This looks
cool, I'll try it out.

-- 
David Jeske (N9LCA) + http://www.chat.net/~jeske/ + jeske@chat.net