lua-users home
lua-l archive

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

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)

  fh:write("line: ", append("\n", ...))

Also check the link below for a more efficient implementation of 'append' using the C API.

Renato Maia
Computer Scientist