return from lua

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

return from lua

Vinu Prasad
I am using lua as server page for the authentication. after the authentication i wnt to retaun a value to the angular js. I simply cheked for for a string retun , bbut it will not work ..plaese anybody knows how to solve it ? How to return the values..

this is my lua script

require "string"
require 'apache2'
--require "json"
json = require 'json'
function handle(r)
local POST, POSTMULTI = r:parsebody()
local name = POST['username']
local user =""
r.content_type = "text/plain"
local result = {}
local file1 = io.open("/var/www/html/login/test.json", "r")
 local contents = file1:read( "*all" )
r:puts("" .. contents)
 return "hello"
end

but it is not returned in the angular ...this is the right method for return values.?

--
Você recebeu essa mensagem porque está inscrito no grupo "Lua BR" dos Grupos do Google.
Para cancelar inscrição nesse grupo e parar de receber e-mails dele, envie um e-mail para [hidden email].
Acesse esse grupo em https://groups.google.com/group/lua-br.
Para mais opções, acesse https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: return from lua

Denis Dos Santos Silva
Hi. This links is only for portuguese brazilian.

about you question:

-- did you using mod_lua* from apache2 ?

-- http response "returns":
- header
- body

can't be 'return' a value to angular.


* documentation of mod_lua -> https://httpd.apache.org/docs/trunk/mod/mod_lua.html


Em quinta-feira, 5 de outubro de 2017 07:24:58 UTC-3, Vinu Prasad escreveu:
I am using lua as server page for the authentication. after the authentication i wnt to retaun a value to the angular js. I simply cheked for for a string retun , bbut it will not work ..plaese anybody knows how to solve it ? How to return the values..

this is my lua script

require "string"
require 'apache2'
--require "json"
json = require 'json'
function handle(r)
local POST, POSTMULTI = r:parsebody()
local name = POST['username']
local user =""
r.content_type = "text/plain"
local result = {}
local file1 = io.open("/var/www/html/login/test.json", "r")
 local contents = file1:read( "*all" )
r:puts("" .. contents)
 return "hello"
end

but it is not returned in the angular ...this is the right method for return values.?

--
Você recebeu essa mensagem porque está inscrito no grupo "Lua BR" dos Grupos do Google.
Para cancelar inscrição nesse grupo e parar de receber e-mails dele, envie um e-mail para [hidden email].
Acesse esse grupo em https://groups.google.com/group/lua-br.
Para mais opções, acesse https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: return from lua

Vinu Prasad
Hiii....Denis

Thanks for the replay. Yes I am using Mod_lua apache2. Is Mod_lua doesn't return value to angular ?. If there is any other method to return values from mod_lua to angular . And thanks for the documentation link attached.


On Friday, October 6, 2017 at 1:53:03 AM UTC+5:30, Denis Dos Santos Silva wrote:
Hi. This links is only for portuguese brazilian.

about you question:

-- did you using mod_lua* from apache2 ?

-- http response "returns":
- header
- body

can't be 'return' a value to angular.


* documentation of mod_lua -> <a href="https://httpd.apache.org/docs/trunk/mod/mod_lua.html" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fhttpd.apache.org%2Fdocs%2Ftrunk%2Fmod%2Fmod_lua.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFvPo9rHx6HtRXi7jm7cuDFV688Yw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fhttpd.apache.org%2Fdocs%2Ftrunk%2Fmod%2Fmod_lua.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFvPo9rHx6HtRXi7jm7cuDFV688Yw&#39;;return true;">https://httpd.apache.org/docs/trunk/mod/mod_lua.html


Em quinta-feira, 5 de outubro de 2017 07:24:58 UTC-3, Vinu Prasad escreveu:
I am using lua as server page for the authentication. after the authentication i wnt to retaun a value to the angular js. I simply cheked for for a string retun , bbut it will not work ..plaese anybody knows how to solve it ? How to return the values..

this is my lua script

require "string"
require 'apache2'
--require "json"
json = require 'json'
function handle(r)
local POST, POSTMULTI = r:parsebody()
local name = POST['username']
local user =""
r.content_type = "text/plain"
local result = {}
local file1 = io.open("/var/www/html/login/test.json", "r")
 local contents = file1:read( "*all" )
r:puts("" .. contents)
 return "hello"
end

but it is not returned in the angular ...this is the right method for return values.?

--
Você recebeu essa mensagem porque está inscrito no grupo "Lua BR" dos Grupos do Google.
Para cancelar inscrição nesse grupo e parar de receber e-mails dele, envie um e-mail para [hidden email].
Acesse esse grupo em https://groups.google.com/group/lua-br.
Para mais opções, acesse https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: return from lua

Denis Dos Santos Silva
In reply to this post by Vinu Prasad
Vinu the scope are different.
When angular and/or browser request a call to server (ajax, get, post, ...) it will retrive the * http header|body * not a 'value'. 
An value can be returned, but, using http status code (like 200, 201, ...)

checkout mod_lua documentation have several examples.

Addenum:  mod_lua alternatives --> http://lua.space/webdev/the-best-lua-web-frameworks <--



Em quinta-feira, 5 de outubro de 2017 07:24:58 UTC-3, Vinu Prasad escreveu:
I am using lua as server page for the authentication. after the authentication i wnt to retaun a value to the angular js. I simply cheked for for a string retun , bbut it will not work ..plaese anybody knows how to solve it ? How to return the values..

this is my lua script

require "string"
require 'apache2'
--require "json"
json = require 'json'
function handle(r)
local POST, POSTMULTI = r:parsebody()
local name = POST['username']
local user =""
r.content_type = "text/plain"
local result = {}
local file1 = io.open("/var/www/html/login/test.json", "r")
 local contents = file1:read( "*all" )
r:puts("" .. contents)
 return "hello"
end

but it is not returned in the angular ...this is the right method for return values.?

--
Você recebeu essa mensagem porque está inscrito no grupo "Lua BR" dos Grupos do Google.
Para cancelar inscrição nesse grupo e parar de receber e-mails dele, envie um e-mail para [hidden email].
Acesse esse grupo em https://groups.google.com/group/lua-br.
Para mais opções, acesse https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: return from lua

Vinu Prasad
Hiii Denis... Thank you for your valid information ,  and the mod_lua documentation link. I will go through it.

On Fri, Oct 6, 2017 at 7:50 PM, Denis Dos Santos Silva <[hidden email]> wrote:
Vinu the scope are different.
When angular and/or browser request a call to server (ajax, get, post, ...) it will retrive the * http header|body * not a 'value'. 
An value can be returned, but, using http status code (like 200, 201, ...)

checkout mod_lua documentation have several examples.

Addenum:  mod_lua alternatives --> http://lua.space/webdev/the-best-lua-web-frameworks <--



Em quinta-feira, 5 de outubro de 2017 07:24:58 UTC-3, Vinu Prasad escreveu:
I am using lua as server page for the authentication. after the authentication i wnt to retaun a value to the angular js. I simply cheked for for a string retun , bbut it will not work ..plaese anybody knows how to solve it ? How to return the values..

this is my lua script

require "string"
require 'apache2'
--require "json"
json = require 'json'
function handle(r)
local POST, POSTMULTI = r:parsebody()
local name = POST['username']
local user =""
r.content_type = "text/plain"
local result = {}
local file1 = io.open("/var/www/html/login/test.json", "r")
 local contents = file1:read( "*all" )
r:puts("" .. contents)
 return "hello"
end

but it is not returned in the angular ...this is the right method for return values.?

--
Você recebeu essa mensagem porque está inscrito em um tópico no grupo "Lua BR" dos Grupos do Google.
Para cancelar inscrição nesse tópico, acesse https://groups.google.com/d/topic/lua-br/-jV19u7SN1Y/unsubscribe.
Para cancelar inscrição nesse grupo e todos os seus tópicos, envie um e-mail para [hidden email].
Acesse esse grupo em https://groups.google.com/group/lua-br.
Para mais opções, acesse https://groups.google.com/d/optout.



--
Vinu Prasad
 

--
Você recebeu essa mensagem porque está inscrito no grupo "Lua BR" dos Grupos do Google.
Para cancelar inscrição nesse grupo e parar de receber e-mails dele, envie um e-mail para [hidden email].
Acesse esse grupo em https://groups.google.com/group/lua-br.
Para mais opções, acesse https://groups.google.com/d/optout.