lua-users home
lua-l archive

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


Vijay Aswadhati wrote:
import "a.b.c"
   ==>
local c = require "a.b.c"

import("a.b.c", d, e, f)
   ==>
local c = require "a.b.c"
local d, e, f = c.d, c.e, c.f

Realistic examples:

import("math", sin, cos, tan)
import("string", sub, gsub, find, gfind)



Very very nice syntax; This is a 'fits like a glove' proposal methinks. I
vaguely remember see this as a feature of Python.

The one nice feature that Python has is:

    from math import *

which imports all names from math into the namespace. I suppose that could be done with:

    import("math", "all")

or something like that.

--
chris marrin                ,""$,
chris@marrin.com          b`    $                             ,,.
                        mP     b'                            , 1$'
        ,.`           ,b`    ,`                              :$$'
     ,|`             mP    ,`                                       ,mm
   ,b"              b"   ,`            ,mm      m$$    ,m         ,`P$$
  m$`             ,b`  .` ,mm        ,'|$P   ,|"1$`  ,b$P       ,`  :$1
 b$`             ,$: :,`` |$$      ,`   $$` ,|` ,$$,,`"$$     .`    :$|
b$|            _m$`,:`    :$1   ,`     ,$Pm|`    `    :$$,..;"'     |$:
P$b,      _;b$$b$1"       |$$ ,`      ,$$"             ``'          $$
 ```"```'"    `"`         `""`        ""`                          ,P`
"As a general rule,don't solve puzzles that open portals to Hell"'