lua-users home
lua-l archive

Re: 5.2 require populates package.loaded with nil

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


Thanks, that assignment takes care of my misunderstanding. 
-----Original Message-----
Message: 5
Date: 2011年9月19日 17:40:10 -0400
From: <AllanPfalzgraf@eaton.com>
Subject: 5.2 require populates package.loaded with nil
To: <lua-l@lists.lua.org>
Message-ID:
	
<4FC6198A618792428E917F64FC7E591504745241@CLEOHSMB03.napa.ad.etn.com>
Content-Type: text/plain;	charset="utf-8"
I have a single-function module build with Visual Studio 2010 that
apparently loads but its function cannot be accessed because the entries
in package.loaded are nil. Below print(type(cb)) returns nil while all
other k's in package.loaded return table.
Obviously, I am doing something wrong?
Here is a link to the code for the module:
http://codepad.org/Yz7jCAHH
C:\Documents and Settings\e0058060\My
Documents\Software\Lua\lua-5.2.0-beta\lua52\Debug>lua
Lua 5.2.0 (beta) Copyright (C) 1994-2011 Lua.org, PUC-Rio
> require("cb")
> for k,v in pairs(package.loaded) do print(k,v) end
string table: 003588E8
debug table: 00358378
package table: 003569F8
_G table: 00354E80
io table: 00357868
os table: 00357528
table table: 00357578
math table: 00359780
cb table: 0035C9A8
coroutine table: 003571F8
bit32 table: 003591E0
> for k,v in pairs(package.loaded.cb) do print(k,v) end
write function: 00381390
> print(type(os))
table
> print(type(cb))
nil
> print(type(string))
table
>
 
	Allan Pfalzgraf 
	EATON
	4201 North 27 Street 
	Milwaukee, WI 53216 
	tel: 414 449-6872 
	fax: 414 449-6616 
	AllanPfalzgraf@eaton.com 
	www.Eaton.com <http://www.eaton.com/> <http://www.eaton.com/> 
------------------------------
Message: 6
Date: 2011年9月19日 19:44:42 -0300
From: Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br>
Subject: Re: 5.2 require populates package.loaded with nil
To: Lua mailing list <lua-l@lists.lua.org>
Message-ID: <20110919224441.GA13349@magritte.tecgraf.puc-rio.br>
Content-Type: text/plain; charset=us-ascii
> Below print(type(cb)) returns nil while all
luaL_newlib does not create a global named cb.
If you need this use
	cb=require"cb"
_______________________________________________
lua-l mailing list
lua-l@lists.lua.org
http://vlists.pepperfish.net/cgi-bin/mailman/listinfo/lua-l-lists.lua.or
g
End of lua-l Digest, Vol 14, Issue 74
*************************************

AltStyle によって変換されたページ (->オリジナル) /