lua-users home
lua-l archive

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


> function foo (a, b)
>  print ("You supplied " .. a .. " and " .. b)
> end
>
> I'd like to be able to store the function as one value, and all the
> parameters for a future call in another single value:
>
> -- store parameters for a future call to "foo(23, 42)"
> f = {func=foo, params={23, 42}}
>
> If I did this, how would I go about calling the function with my
> stored parameters?  If I wrote "f.func(f.params)" it would be wrong;

would this work:

f.func(unpack(f.params))