[luci] luci.http.header don't works
Lay András
andras at lay.hu
Tue Apr 24 14:28:06 CEST 2012
Hello!
On Fri, Apr 20, 2012 at 5:52 PM, Jo-Philipp Wich <xm at subsignal.org> wrote:
> Hi,
>
> use prepare_content to set the type:
>
> luci.http.prepare_content('text/html; charset=UTF-8')
> luci.http.write('Hello world')
Hi!
I tried your suggestion. My lua script:
---------------------------------------------------
#!/usr/bin/lua
require'luci.http'
luci.http.prepare_content('text/html; charset=UTF-8')
luci.http.write('Hello world')
---------------------------------------------------
>From the browser nothing visible, i traced with livehttpheaders, the
response content-type is text/plain, but no data. I tried the script
from command line:
root at OpenWrt:/mnt/web/cgi-bin# lua lufi.lua
lua: attempt to yield across metamethod/C-call boundary
stack traceback:
[C]: in function 'yield'
/usr/lib/lua/luci/http.lua:191: in function 'header'
/usr/lib/lua/luci/http.lua:205: in function 'prepare_content'
lufi.lua:5: in main chunk
[C]: ?
root at OpenWrt:/mnt/web/cgi-bin#
Bye!
Lay
More information about the luci
mailing list