lua-users home
lua-l archive

Re: write a list of variables to a file, formatted

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


On 26/06/2013 16:45, Daniel Barna wrote:
Hi, I have a function which return a list of variables:
function some_function()
 return a,b,c,d;
end
I would like to write this to a file, using a whitespace as the separator, something like
this:
some_file:write(some_function());
> lua52
Lua 5.2.0 Copyright (C) 1994-2011 Lua.org, PUC-Rio
> f = function () return 1, 2, 3, 4 end
> print(f())
1 2 3 4
> print(table.concat(table.pack(f()), " "))
1 2 3 4
--
Philippe Lhoste
-- (near) Paris -- France
-- http://Phi.Lho.free.fr
-- -- -- -- -- -- -- -- -- -- -- -- -- --

AltStyle によって変換されたページ (->オリジナル) /