lua-users home
lua-l archive

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


The server doesn't need to parse the body. I'm not talking about returning one string for the response, I'm talking about returning this:
 return 200, {["Content-Type"] = "text/plain"}, "Hello world!"
instead of having to do this:
 return 200, {["Content-Type"] = "text/plain"}, {"Hello world!"}
or this:
 local first=true
return 200, {["Content-Type"] = "text/plain"}, function() if first then return "Hello world!" first=nil else return nil end end

-----Original Message----- From: Chris Babcock Sent: Tuesday, January 25, 2011 1:42 PM Newsgroups: gmane.comp.lang.lua.general
To: Lua mailing list
Subject: Re: WSAPI replacement draft

On Tue, Jan 25, 2011 at 5:59 AM, Stuart P. Bentley
<stuart@testtrack4.com> wrote:
Also, why can't the response body just be a string?

If you return a string to the server, it will need to be parsed.
Considering that this data was probably in variables before it became
a string, it's rather wasteful to prepare string output for a parser
when it could be assigned to a var in the API. Or...

Table, fast; string, slow.

Chris
--
51st century guy