Left here for archival purposes.

User avatar
By papagenic
#6383 ok, thanks,

but then how would you deal with an exemple which needs to keep a context between iterations?
Take this exemple:

Code: Select allwifi.sta.getap(function(apList)
  for sid,d in pairs(apList) do
   conn:send( '<option value="'..sid..'">'..sid..'</option>')
  end
end)


thanks
User avatar
By Markus Gritsch
#6387 With a generator. Read about coroutines, yield, and iterators here http://www.lua.org/pil/9.1.html and here http://www.lua.org/pil/9.3.html. Probably also about closure and lexical scoping here http://www.lua.org/pil/6.1.html.

If time permits read all of the online version of the first edition of "Programming in Lua" which covers Lua 5.0 or buy a newer edition.

BTW, 'isopen' from the example above is also a state which is stored between iterations. You can access the elements of your 'apList' in the same way.
User avatar
By yes8s
#6543 Anyone get anywhere with this issue?

I too started getting the blank web page when I went to >=0.9.4. Previously, it was sending large chunks of html data ~1200-1400 bytes at a time with no issue.

Now it does seem that if there are several conn:sent(xx) commands in a row within a conn:on('sent'..) function (as you'd get when reading then sending lines from a html file) they are lost due to the conn:on('sent'..) being called prematurely over and over again.

My current workaround is to read and send each html line of text line by line which is soooo slow now. Even smallish webpages can be seen to load bit by bit on the browser. It's ugly.

Zeroday has said nothing has changed in the lua API but there was some change in the SDK which could affect things but I don't think he's checked it.