lua-users home
lua-l archive

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


On Thu, Mar 16, 2017 at 1:21 PM, Eike Decker <zet23t@googlemail.com> wrote:
> Slightly OT but on topic of how to improve multiple assignments:
> Has anyone ever wished for something like
>
> local sub, gmatch, match load string
> -- where load is a keyword that is syntactic sugar for 'local sub, gmatch,
> match = string.sub, string.gmatch, string.match'

Take a look at http://www.freelists.org/post/luajit/local-in-syntax,24
and https://gist.github.com/meric/1883adb92044b75237bb0b42a63d5ed4
It provides hacks for the following syntaxes:

  local exp, log, sin, cos, tan within (math, 5)

and

  local import,
    asin, acos, atan from (math)

-- 
Best regards,
Boris Nagaev