1
0
Fork 0
mirror of https://github.com/ctruLua/ctruLua.git synced 2025-10-27 16:39:29 +00:00

Cleaned up the HTTPC lib

This commit is contained in:
Firew0lf 2015-08-24 21:25:25 +02:00
parent d3ca4d0360
commit 800dd6f963

View file

@ -8,22 +8,6 @@
#include <lapi.h> #include <lapi.h>
#include <lauxlib.h> #include <lauxlib.h>
/*static int httpc_init(lua_State *L) {
Result ret = httpcInit();
if (ret != 0) {
lua_pushnil(L);
lua_pushinteger(L, ret);
return 2;
}
lua_pushboolean(L, true);
return 1;
}*/
/*static int httpc_shutdown(lua_State *L) {
httpcExit();
return 0;
}*/
static int httpc_context(lua_State *L) { static int httpc_context(lua_State *L) {
httpcContext context; httpcContext context;
Result ret = httpcOpenContext(&context, "http://google.com/", 0); // Initialization only. Result ret = httpcOpenContext(&context, "http://google.com/", 0); // Initialization only.
@ -105,7 +89,6 @@ static int httpc_downloadData(lua_State *L) {
u32 size = 0; u32 size = 0;
httpcGetDownloadSizeState(context, NULL, &size); httpcGetDownloadSizeState(context, NULL, &size);
u8 *buff = (u8*)malloc(size); u8 *buff = (u8*)malloc(size);
//memset(buff, 0, size);
ret = httpcDownloadData(context, buff, size, NULL); ret = httpcDownloadData(context, buff, size, NULL);
if (ret != 0) { if (ret != 0) {
@ -113,7 +96,6 @@ static int httpc_downloadData(lua_State *L) {
lua_pushinteger(L, ret); lua_pushinteger(L, ret);
return 2; return 2;
} }
//strcpy(buff, "loltest");
lua_pushstring(L, (char*)buff); lua_pushstring(L, (char*)buff);
free(buff); free(buff);
@ -142,8 +124,6 @@ static const struct luaL_Reg httpc_methods[] = {
// module // module
static const struct luaL_Reg httpc_functions[] = { static const struct luaL_Reg httpc_functions[] = {
// {"init", httpc_init },
// {"shutdown", httpc_shutdown},
{"context", httpc_context }, {"context", httpc_context },
{NULL, NULL} {NULL, NULL}
}; };