Forum

> > CS2D > Scripts > Advanced Web Functions in LUA
Forums overviewCS2D overview Scripts overviewLog in to reply

English Advanced Web Functions in LUA

24 replies
Page
To the start Previous 1 2 Next To the start

old Advanced Web Functions in LUA

sixpack
User Off Offline

Quote
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!

old Re: Advanced Web Functions in LUA

sixpack
User Off Offline

Quote
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!

old Re: Advanced Web Functions in LUA

TimeQuesT
User Off Offline

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

edit:

os.execute (command) should help
edited 1×, last 19.10.11 04:05:19 pm

old Re: Advanced Web Functions in LUA

Apache uwu
User Off Offline

Quote
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.

old Re: Advanced Web Functions in LUA

sixpack
User Off Offline

Quote
user Apache uwu has written
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)

old Re: Advanced Web Functions in LUA

sixpack
User Off Offline

Quote
user DannyDeth has written
@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?

old Re: Advanced Web Functions in LUA

DannyDeth
User Off Offline

Quote
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.

old Re: Advanced Web Functions in LUA

sixpack
User Off Offline

Quote
@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.

old Re: Advanced Web Functions in LUA

Flacko
User Off Offline

Quote
user sixpack has written
@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.

old Re: Advanced Web Functions in LUA

palomino
User Off Offline

Quote
user Flacko has written
user sixpack has written
@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?

old Re: Advanced Web Functions in LUA

Flacko
User Off Offline

Quote
user palomino has written
user Flacko has written
user sixpack has written
@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.
edited 1×, last 20.10.11 02:41:21 am

old Re: Advanced Web Functions in LUA

Apache uwu
User Off Offline

Quote
user palomino has written
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.
To the start Previous 1 2 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview