lua-users home
lua-l archive

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


Lua list <lua@bazar2.conectiva.com.br> writes:
>May I suggest a different API, giving you the best of both worlds:
>
>  -- No property given: return table with all (named) properties.
>  local st = apr.stat(path)
>  print(st.size, st.mtime, ...)
>
>  -- Individual properties given: use multiple return values.
>  local size, mtime = apr.stat(path, "size", "mtime")
>  if size > 0 and mtime ~= prev_mtime then ... end

Is it possible/desirable for the APR module to add a general purpose
vararg function called "pack" (symmetrical with the existing "unpack" in
the standard library) that collects all its arguments into a table? I
suspect it might be more difficult than this - there is probably a good
reason why there is no "pack" function already in the standard lib.

Anyway, if it is possible, you could just write:-

    local table = pack(apr.stat(path))

...for the first case.

&.


#####################################################################################
This e-mail message has been scanned for Viruses and Content and cleared 
by MailMarshal.
The Blackpool Sixth Form College.
#####################################################################################