lua-users home
lua-l archive

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


I have always found Peter Shook's "Unpack Tables by Name" patch
very convenient with Lua 5.1. You could simply write

  local x,y,z in t

in place of

   local x,y,z = t.x,t.y,t.z

In Lua 5.2 the syntax of Shook's patch would appear to clash
with that for lexical environments, because after "local x,y,z in t"
the keyword "do" is expected. Does anybody have any suggestions
for a resolving this clash. Shook's patch is for reading values
from a table without having to keep repeating the table expression,
whereas lexical environments are for writing to a table without
having to keep repeating the table expression. It would be more
be more balanced if both could be done.

-- 
Gavin Wraith (gavin@wra1th.plus.com)
Home page: http://www.wra1th.plus.com/