[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Basic question about modules
- From: steve donovan <steve.j.donovan@...>
- Date: Tue, 5 Oct 2010 14:16:12 +0200
On Tue, Oct 5, 2010 at 1:56 PM, Thijs Koerselman
> local require, print = require, print
> module 'mymodule'
> require 'string'
> print(string.format('%s', 'some string'))
After your call to module(), the environment of the chunk has changed,
and require 'string' isn't clever enough to bring the name 'string'
into the module environment. You would have to say 'local string =
require 'string'' at this point.
This is the kind of weirdness that has led to Lua 5.2 dropping
module() altogether - too much messing around with function