aboutsummaryrefslogtreecommitdiff
path: root/src/net/lua.c
diff options
context:
space:
mode:
authorame <[email protected]>2026-06-08 22:43:05 -0500
committerame <[email protected]>2026-06-08 22:43:05 -0500
commit66aedfd65cff3494b70e8072646094479e3bfed8 (patch)
tree0106935549143d542819da445e9a74740d617d94 /src/net/lua.c
parent4cbf47f295fc65e4a470d93194259d80c942b32b (diff)
net util
Diffstat (limited to 'src/net/lua.c')
-rw-r--r--src/net/lua.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/net/lua.c b/src/net/lua.c
index ffa10c4..025828b 100644
--- a/src/net/lua.c
+++ b/src/net/lua.c
@@ -85,11 +85,29 @@ int l_send(lua_State* L){
else closesocket(ctx->sock);
ctx->sock = -1;
+ lua_pushboolean(L, 0);
+ lua_setfield(L, res_idx, "open");
+
//printf("%i | %i\n'%s'\n%i\n",client_fd,a,resp->c,resp->len);
str_free(resp);
return 0;
}
+int l_neterror(lua_State* L){
+ int res_idx = 1;
+ lua_getfield(L, res_idx, "_");
+ struct net_data* ctx = lua_touserdata(L, -1);
+
+ client_fd_errors(ctx->sock);
+
+ net_error(ctx, luaL_checkinteger(L, 2));
+
+ lua_pushboolean(L, 0);
+ lua_setfield(L, res_idx, "open");
+
+ return 0;
+}
+
int l_close(lua_State* L){
int res_idx = 1;
@@ -103,6 +121,9 @@ int l_close(lua_State* L){
else closesocket(ctx->sock);
ctx->sock = -1;
+ lua_pushboolean(L, 0);
+ lua_setfield(L, res_idx, "open");
+
return 0;
}
@@ -267,6 +288,9 @@ int l_sendfile(lua_State* L){
break;
}
+ lua_pushboolean(L, 0);
+ lua_setfield(L, res_idx, "open");
+
free(buffer);
fclose(fp);