lua-users home
lua-l archive

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

X-Organization: Soft Intangibles
User-Agent: Messenger-Pro/1.00c (MsgServe/1.00a) (RISC-OS/5.21) POPstar/2.06-ds.5
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii

In message
<> you wrote:

> I don't know if the application would be considered wide enough but:
> local * = t.a, t.b, t.c

I have used a restricted form of Peter Shook's patch for RiscLua for
many years now, so I can write

 local a, b, c in t

and I find it an invaluable and intelligible shortcut.

> I'd only say that the crazy amount of "a, b, c = a, b, c" is rather hard to
> explain as a "sweet feature of Lua"

In RiscLua I would use

   local a, b, c in _ENV

The code for Peter Shook's patch is much simplified by the restriction
to local statements. In fact I cannot see the point of having anything
more general. It is particularly useful for code that is doing things
with lists of labelled records; stuff like

   for _, record in ipairs (database) do
      local name, email, address in record -- attributes
      process (name, email, address)
   end -- for

becomes a standard trope.

Gavin Wraith (
Home page: