[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: newbie to lua :-) a trivial question...
- From: Renato Maia <maia@...>
- Date: Thu, 18 Nov 2010 11:04:50 -0200
On 18 Nov 2010, at 09:14, starwing wrote:
how can I insert the multi return value from a function to a middle
of a table?
e.g. fh:write("line: ", ..., "\n")
function append(val, ...)
local c = select("#", ...)+1
return unpack({[c] = val, ...}, 1, c)
end
fh:write("line: ", append("\n", ...))
Also check the link below for a more efficient implementation of
'append' using the C API.
http://www.tecgraf.puc-rio.br/~maia/lua/vararg/
--
Renato Maia
Computer Scientist
Tecgraf/PUC-Rio
__________________________
http://www.inf.puc-rio.br/~maia/