moonscript
moonscript copied to clipboard
Feature request: Renaming imports, import X as Y from Z
Currently, the import statement works really well for bringing in stuff into local scope, but an issue arises if two things you want to import have the same name:
import GetAll from player
import GetAll from ents
local GetAll
GetAll = player.GetAll
GetAll = ents.GetAll -- ouch, goodbye player.GetAll
Ideally, some small piece of optional syntax could be used to denote the name that the particular item would have in the following scope; import GetAll as eGetAll from ents.
Thoughts would be appreciated.
Edit:
As with the original import statement, there is a way around this with table comprehensions:
import a from b
{:c} = d
{e: eFromF} = f
local a
a = b.a
local c
c = d.c
local eFromF
eFromF = f.e