Forum

> > CS2D > Scripts > Advanced Web Functions in LUA
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Advanced Web Functions in LUA

24 Antworten
Seite
Zum Anfang Vorherige 1 2 Nächste Zum Anfang

alt Advanced Web Functions in LUA

sixpack
User Off Offline

Zitieren
Hello there fellow scripters.
I was interested if there are any lua functions (not in real lua, part that is implemented to cs2d) that can help you run some HTTP requests (mostly POST) and get a response. If yes, any manuals available to handle these?

It would be great since cs2d would have way more possibilities of expansion that way because it wouldn't be just Lua, it would be PHP, ASP.NET, JavaScript and lot's more web languages. Also it would support MySQL. By just adding POST requests!

alt Re: Advanced Web Functions in LUA

sixpack
User Off Offline

Zitieren
It would give much more powers to cs2d. Imagine using a MySQL DB for saves, and stuff. Much more secure, much more 'cloudy'. You can run a server in more than 1 computers!

alt Re: Advanced Web Functions in LUA

TimeQuesT
User Off Offline

Zitieren
Write a .exe file which sends the POST/GET. Execute this file via lua.

edit:

os.execute (command) should help
1× editiert, zuletzt 19.10.11 16:05:19

alt Re: Advanced Web Functions in LUA

Apache uwu
User Off Offline

Zitieren
Urm..you still need to import stuff, sockets aren't packages with cs2d.

---> Also lua does support sql, however it does make the dedicated server pause while it's adding or reading entries.

alt Re: Advanced Web Functions in LUA

sixpack
User Off Offline

Zitieren
user Apache uwu hat geschrieben
Urm..you still need to import stuff, sockets aren't packages with cs2d.

---> Also lua does support sql, however it does make the dedicated server pause while it's adding or reading entries.


a={"Name", "Age"}
v={"DaKnOb", "99"}
post("www.google.com/cs2d.php", a,v)

alt Re: Advanced Web Functions in LUA

sixpack
User Off Offline

Zitieren
user DannyDeth hat geschrieben
@user sixpack:
That would be easily possible.. except passing tables in post. That would require some ingenuity.

Well this is just an idea so you can post more than one stuff per time. Other idea is this:
1
2
3
4
5
6
7
8
r = request.post()
r.add("Name", "DaKnOb")
r.add("Age", 99)
r.send()
if(r.response == "...") then

end
--Or response may be handled as hook?

alt Re: Advanced Web Functions in LUA

DannyDeth
User Off Offline

Zitieren
Actually, Daknob, that wouldn't be that hard with LuaSocket, since it has HTTP support 'right out of the box' itself. Not sure about POST, I don't think it will be hard, but you could always use GET anyway.

alt Re: Advanced Web Functions in LUA

sixpack
User Off Offline

Zitieren
@user DannyDeth: Get is not as good as POST is. Some characters are just not sendable and it has some more problems, plus I need to read the request. I want DC to implement it to the lua that comes with cs2d itself. It would enable much more possibilities.

alt Re: Advanced Web Functions in LUA

Flacko
User Off Offline

Zitieren
user sixpack hat geschrieben
@user DannyDeth: Get is not as good as POST is. Some characters are just not sendable and it has some more problems, plus I need to read the request. I want DC to implement it to the lua that comes with cs2d itself. It would enable much more possibilities.


Use php's urlencode() function (or write your own)

This idea is horrible. CS2D isn't some sort of web browser. Just make a Lua dll addon to bind it with some library.

alt Re: Advanced Web Functions in LUA

palomino
User Off Offline

Zitieren
user Flacko hat geschrieben
user sixpack hat geschrieben
@user DannyDeth: Get is not as good as POST is. Some characters are just not sendable and it has some more problems, plus I need to read the request. I want DC to implement it to the lua that comes with cs2d itself. It would enable much more possibilities.


Use php's urlencode() function (or write your own)

This idea is horrible. CS2D isn't some sort of web browser. Just make a Lua dll addon to bind it with some library.

You mean an injector? Aren't those illegal?

alt Re: Advanced Web Functions in LUA

Flacko
User Off Offline

Zitieren
user palomino hat geschrieben
user Flacko hat geschrieben
user sixpack hat geschrieben
@user DannyDeth: Get is not as good as POST is. Some characters are just not sendable and it has some more problems, plus I need to read the request. I want DC to implement it to the lua that comes with cs2d itself. It would enable much more possibilities.


Use php's urlencode() function (or write your own)

This idea is horrible. CS2D isn't some sort of web browser. Just make a Lua dll addon to bind it with some library.

You mean an injector? Aren't those illegal?


Yes, they are forbidden, but I'm not talking about an injector. I'm just talking about a dll you can load through a lua function that supplies you with even more functions that help you achieve stuff using C/C++ through Lua.
1× editiert, zuletzt 20.10.11 02:41:21

alt Re: Advanced Web Functions in LUA

Apache uwu
User Off Offline

Zitieren
user palomino hat geschrieben
You mean an injector? Aren't those illegal?


Yeah importing a dll into cs2d (client side or server side) is against the rules. I'm pretty sure DC wouldn't mind if it were server-sided

Example: Getting some info tcp based serversided.
Zum Anfang Vorherige 1 2 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht