From 575e22afdc316bd0d3b2cedb10d00d8b50b3b5dd Mon Sep 17 00:00:00 2001 From: ame Date: Mon, 29 Jan 2024 09:54:16 -0600 Subject: test --- src/reg.c | 100 +++++++++++++++++++++++++++++++------------------------------- 1 file changed, 50 insertions(+), 50 deletions(-) (limited to 'src/reg.c') diff --git a/src/reg.c b/src/reg.c index 3d991a2..38d5ee9 100644 --- a/src/reg.c +++ b/src/reg.c @@ -1,50 +1,50 @@ -#include "lua.h" -#include "table.h" -#include "crypto.h" -#include "config.h" -#include "io.h" -#include "math.h" -#include "net.h" -#include - -static int lua_exit(lua_State* L){ - printf("hi\n"); - return 0; -} - -void sigHandle(int s){ - signal(s, SIG_IGN); - printf("meow\n"); - signal(s, sigHandle); -} - -int luaopen_llib(lua_State* L) { - /* - - lua_newuserdata(L, sizeof(void*)); - luaL_newmetatable(L, "gc"); - lua_pushstring(L, "__gc"); - lua_pushcfunction(L, &lua_exit); - lua_settable(L, -3); - - lua_setmetatable(L, -2); - lua_setfield(L, LUA_REGISTRYINDEX, "grr"); - signal(SIGTERM, sigHandle); - signal(SIGINT, sigHandle); -*/ - //create .array functions - lua_newtable(L); - - //lua_newtable(L); - - lreg("array", array_function_list); - lreg("crypto", crypto_function_list); - lreg("io", io_function_list); - lreg("math", math_function_list); - lreg("config", config_function_list); - lreg("net", net_function_list); - - //make llib global - lua_setglobal(L, "llib"); - return 1; -} +#include "lua.h" +#include "table.h" +#include "crypto.h" +#include "config.h" +#include "io.h" +#include "math.h" +#include "net.h" +#include + +static int lua_exit(lua_State* L){ + printf("hi\n"); + return 0; +} + +void sigHandle(int s){ + signal(s, SIG_IGN); + printf("meow\n"); + signal(s, sigHandle); +} + +int luaopen_llib(lua_State* L) { + /* + + lua_newuserdata(L, sizeof(void*)); + luaL_newmetatable(L, "gc"); + lua_pushstring(L, "__gc"); + lua_pushcfunction(L, &lua_exit); + lua_settable(L, -3); + + lua_setmetatable(L, -2); + lua_setfield(L, LUA_REGISTRYINDEX, "grr"); + signal(SIGTERM, sigHandle); + signal(SIGINT, sigHandle); +*/ + //create .array functions + lua_newtable(L); + + //lua_newtable(L); + + lreg("array", array_function_list); + lreg("crypto", crypto_function_list); + lreg("io", io_function_list); + lreg("math", math_function_list); + lreg("config", config_function_list); + lreg("net", net_function_list); + + //make llib global + lua_setglobal(L, "llib"); + return 1; +} -- cgit v1.2.3