lua-users home
lua-l archive

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

On Mon, Nov 18, 2013 at 6:20 PM, Pierre-Yves Gérardy <> wrote:
>> Is syntactic sugar for:
>>     local t = some_table_expression
>>     local a, b, c = t.a, t.b, t.c
> That's almost exactly what I do, sans sugar.
>     local s, t = string, table
>     local s_byte, s_sub, t_concat, t_insert, t_remove, t_unpack
>         = s.byte, s.sub, t.concat, t.insert, t.remove, t.unpack
> I type them using the multiple cursor option in my editor, then change
> the underscores to dots.
> The alignment (hopefully your mail client uses a fixed width font)
> makes it easier to spot errors.
> You must like prefixes, though.

FWIW, what we do, regarding import, is

local foo, bar = import 'baz.lua' { 'foo', 'bar' }

local insert, concat = import (table) { 'insert', 'concat' }

would work too (but we usually don't do that, favoring prefixed version).

My 2c,

P.S. Implementation (not the most elegant) is here: