lua-users home
lua-l archive

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


On Tue, 21 Mar 2006 21:55:19 +0000 (GMT) Reuben Thomas <rrt@sc3d.org>
wrote:
> local string = string
> module "a"
> 
> but this is rather ugly

I don't think so ...
You can also do :
local _G = _G
and use _G.mytoplevelfunction(args) instead of mytoplevelfunction(args)

Another solution is to do :
module("mymod", package.seeall)
It will set the __index metafield of the package table to _G ... so
mymod.print will be the same as _G.print. You'll be able to use all
global variables in your module ...


-- 
Mildred       <xmpp:mildred@jabber.fr> <http://mildred632.free.fr/>
Clef GPG :    <hkp://pgp.mit.edu> ou <http://mildred632.free.fr/gpg_key>
Fingerprint : 197C A7E6 645B 4299 6D37 684B 6F9D A8D6 [9A7D 2E2B]