lua-users home
lua-l archive

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


Hi Diego,

Thanks for your valuable inputs.

I want LuaSocket always loaded when I run the interpreter. But for
testing purposes I want LuaSocket to be loaded only when a script calls
require().

For this I need below things.
1)package.preload table & contents.
2)How to make an entry of this table.
3)in which file I have to include this table.
4)package.preload table contents. 

Could you please help in providing the above information.  


Thanks & Regards,
Adimurthy

-----Original Message-----
From: lua-bounces@bazar2.conectiva.com.br
[mailto:lua-bounces@bazar2.conectiva.com.br] On Behalf Of Diego Nehab
Sent: Tuesday, July 15, 2008 8:10 AM
To: Lua list
Subject: Re: Compiling lua statically with luasockets.

Hi,

> 1.  make a static luasocket library; add these 2 lines to your lua 
> makefile 2.  edit lua.c 3.  edit makefile; append "-L . -lluasocket" 
> to the line that compiles 4.  do a make

If you still have access to socket.lua, mime.lua and its friends through
the filesystem, this is the way to go.

If you won't have a filesystem, you need to take a look at luac and
bin2c. These allow you to turn a .lua file into a .c file, which you can
compile and link with your monolythic executable.

The other decision you have to make is whether you care if LuaSocket is
always loaded when you run the interpreter, or if you want it to be
loaded only when a script calls require(). If the latter is important,
you will have to use the package.preload table.

[]s,
Diego

Please do not print this email unless it is absolutely necessary. 

The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. 

www.wipro.com