[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Can I get two instances of the same module?
- From: Thijs Schreijer <thijs@...>
- Date: Thu, 6 Mar 2014 09:45:55 +0000
> -----Original Message-----
> From: lua-l-bounces@lists.lua.org [mailto:lua-l-bounces@lists.lua.org] On
> Behalf Of Journeyer J. Joh
> Sent: donderdag 6 maart 2014 9:00
> To: Lua mailing list
> Subject: Re: Can I get two instances of the same module?
>
> Hi Peter Melnichenko and Dirk Laurie,
>
> I tested under
>
> Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio
>
> And now things seem confusing...
> What I imported by require is from the url below.
> http://lua-users.org/wiki/TemplatePattern
> The account.lua.
>
> And I have no idea then...
>
> Regards
> Journeyer
>
Try this:
local aaa = require "account"
print(aaa)
package.loaded["account"] = nil
local bbb = require "account"
print(bbb)
print(account) --> global was created by module() function
-- try again by also setting global to nil
account = nil
package.loaded["account"] = nil
local ccc = require "account"
print(ccc)
print(account)
the above works for me.
Thijs