lua-users home
lua-l archive

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

Hello everyone,

   I am quite new to the Lua scene, as I have only recently started my
first Lua project (a convenient web-based front-end for a database
that I work with on a daily basis). Everything is running smoothly
thus far, however, I am curious about one of the CGILua functions that
is mentioned in the Kepler Project's documentation for CGILua:

Here is what the Kepler Project's documentation says about the function:

>>cgilua.contentheader (type, subtype)
>>    Sends a Content-type header with the given values of type and sub-type.
>>    Both arguments are strings: type is the header type; subtype is
the header sub-type.
>>    Returns nothing.

   I am not sure how "type" and "subtype" are used by the function;
i.e. does the function prefix "type" with the required "Content-type:"
string? If so, what does it do with the "subtype" argument? I know
that in other languages such as C and PHP, I generate the content
header for a valid XHTML file by printing the following line to the
beginning of my file: "Content-type: application/xhtml+xml;
charset=UTF-8\n\n". Before bothering the Lua list, I decided to
investigate a little further, on my own (lines 20-23 of my copy of

>>    -- Headers
>>    SAPI.Response.contenttype = function (s)
>>        io.stdout:write ("Content-type: "..s.."\n\n")
>>    end

So, I am guessing it takes the first argument, "type", and writes it
in the proper content-type form, which I briefly mentioned earlier.
Again, this still leaves me wondering: what is the "subtype" argument
used for? I will continue investigating on my own, but I am not
heavily experienced in Lua, so any help is more than appreciated.

Jeff Wilges

I was told in #lua on FreeNode to try posting any Kepler questions to
this list; sorry, if this is the incorrect list for this question.