[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: what's wrong?
- From: Mike Pall <mikelu-0509@...>
- Date: Sat, 3 Sep 2005 22:22:50 +0200
> Please help me to find my mistake in 5.1 alpha compilation.
It's not a problem with your compilation.
> After module(...) all global variables is undefined!
This is documented in the manual that accompanies Lua 5.1 alpha.
Read the comments for package.seeall(), too.
What you really want to do is:
-- Cache any globals you may want to use.
local print = print
local version = _VERSION
-- Load any other modules you may want to use. Example:
-- local foo = require "foo"
-- Start the module definitions. All globals are gone after this!
print("Hello world, from ", version, "!\n")
Well, unless you were lazy ... then you could just use
and continue using globals. But this is slower and not
the recommended practice.
A recent mailing list thread inspired this change: