www.8devices.com
|
|
|
Page 1 of 1
|
[ 3 posts ] |
|
Author |
Message |
wpfundstein
Joined: 16 Jun 2012, 17:02 Posts: 3
|
Hi,
i have installed lua and have problems to use tcp socket.
in lua source file:
require("socket")
results in "module 'socket' not found.
how can i install the socket.lua?
Regards, Werner
|
04 Sep 2012, 09:48 |
|
|
Theo
Joined: 26 Dec 2011, 16:49 Posts: 11
|
Using LuaSocket
Just use the require function to gain access to whatever module you need:
#!/usr/bin/lua socket = require("socket") Modules loads their dependencies automatically, so you only need to load the modules you directly depend upon.
To download a webpage or post something use the socket.http
#!/usr/bin/lua http = require("socket.http") print(http.request("http://http://www.8devices.com"))
homepage of this website gets dumped to terminal
To use mail:
#!/usr/bin/lua smtp = require("socket.smtp")
mesgt = { headers = { from = "First Name <yourname@yourdomain>", to = "Real Name <yourfriend@anotherdomain>", subject = "How about this" }, body = "Hello my friend" }
r, e = smtp.send { from = "<yourname@yourdomain>", rcpt = "<yourfriend@anotherdomain>", server = "your.smtp.server", source = smtp.message(mesgt) }
I hopes this helps
|
04 Dec 2012, 21:37 |
|
|
NaYthan
Joined: 14 May 2012, 15:48 Posts: 196
|
Theo, I think you misunderstood him...
I don't know how it is for lua, but in python you can just drop modules in the appropriate directory within your python install, or even place them in the same directory as your programm. I suppose, since this is an embedded system with little memory, most modules will not be present in that lua installation. The same was true for python. So I just googled for the full python ramips package, extracted the modules I needed and copied them to my target system.
So I think you could do the same. Google for the full lua package or even just the module you're looking for and copy it to your Carambola.
|
06 Dec 2012, 12:19 |
|
|
|
Page 1 of 1
|
[ 3 posts ] |
|
Who is online |
Users browsing this forum: No registered users |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|