need help for >> what is actual structure of lua?
Posted: Tue Feb 16, 2016 1:10 pm
hello all,
i learn most of lua language's books (only indexes, that what i search for )
i just search whole history of lua on google also but still i'm confused that which kind of code is that?
where is function ,variable and how to call function ,how to get return value from called function?
and main thing, is is their any flow chart OR any documentation for how to define client and server ?
i mean if we use esp8266 as http client then what process is done in program step by step?
EX:- if we use arduino IDE >> first define librarys that we used in program
then variables and constants,SETUP and finally LOOP.
and good thing is arduino have all perfect explanation on own web
>>>>>https://www.arduino.cc/en/Reference/HomePage
but when i try to create server on esp8266 i got ready code from github but not any basic concept for that LIKE what is "net.TCP" " listeten(80,184.106.153.149) " and blah blah blah
here is sample of program...................<< can any one have idea that where i found any guidance or help?
> conn=net.createConnection(net.TCP, 0)
> conn:on("connection",function(conn, payload)
>> conn:send("HEAD / HTTP/1.1\r\n"..
>> "Host: https://api.thingspeak.com/apps/thinght ... L7DOCEHHX9\r\n"..
"Accept: */*\r\n"..
>> "User-Agent: Mozilla/4.0 (compatible; esp8266 Lua;)"..
>> "\r\n\r\n")
>> end)
>
> conn:on("receive", function(conn, payload)
>> print('\nRetrieved in '..((tmr.now()-t)/1000)..' milliseconds.')
>> print('Google says it is '..string.sub(payload,string.find(payload,"Date: ")
>> +6,string.find(payload,"Date: ")+35))
>> conn:close()
>> end)
> t = tmr.now()
> conn:connect(80,"184.106.153.149")
i learn most of lua language's books (only indexes, that what i search for )
i just search whole history of lua on google also but still i'm confused that which kind of code is that?
where is function ,variable and how to call function ,how to get return value from called function?
and main thing, is is their any flow chart OR any documentation for how to define client and server ?
i mean if we use esp8266 as http client then what process is done in program step by step?
EX:- if we use arduino IDE >> first define librarys that we used in program
then variables and constants,SETUP and finally LOOP.
and good thing is arduino have all perfect explanation on own web
>>>>>https://www.arduino.cc/en/Reference/HomePage
but when i try to create server on esp8266 i got ready code from github but not any basic concept for that LIKE what is "net.TCP" " listeten(80,184.106.153.149) " and blah blah blah
here is sample of program...................<< can any one have idea that where i found any guidance or help?
> conn=net.createConnection(net.TCP, 0)
> conn:on("connection",function(conn, payload)
>> conn:send("HEAD / HTTP/1.1\r\n"..
>> "Host: https://api.thingspeak.com/apps/thinght ... L7DOCEHHX9\r\n"..
"Accept: */*\r\n"..
>> "User-Agent: Mozilla/4.0 (compatible; esp8266 Lua;)"..
>> "\r\n\r\n")
>> end)
>
> conn:on("receive", function(conn, payload)
>> print('\nRetrieved in '..((tmr.now()-t)/1000)..' milliseconds.')
>> print('Google says it is '..string.sub(payload,string.find(payload,"Date: ")
>> +6,string.find(payload,"Date: ")+35))
>> conn:close()
>> end)
> t = tmr.now()
> conn:connect(80,"184.106.153.149")