lua-users home
lua-l archive

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




On 05/03/17 01:38 PM, Dirk Laurie wrote:
2017-03-05 16:56 GMT+02:00 Soni L. <fakedme@gmail.com>:

Have you ever tried:
...
function myfile:write(...)
   local x = #self
...

No ... but I habitually put in my programs

local append = function(tbl,obj,...)
   if ... then obj = obj:format(...) end
   table.insert(tbl,obj)
end

I meant calling one of those "static file functions" with a custom "virtual" file that writes to a table instead of writing to an actual file.

Also, file:write() takes a varargs.

--
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.