diff options
| author | ame <[email protected]> | 2024-01-29 09:54:16 -0600 |
|---|---|---|
| committer | ame <[email protected]> | 2024-01-29 09:54:16 -0600 |
| commit | 575e22afdc316bd0d3b2cedb10d00d8b50b3b5dd (patch) | |
| tree | 17bf2d289774788cfafc4504930737a3e9885101 /src/reg.c | |
| parent | bafa906b6c51064e9ab429f81666feaf4c9e1740 (diff) | |
test
Diffstat (limited to 'src/reg.c')
| -rw-r--r-- | src/reg.c | 100 |
1 files changed, 50 insertions, 50 deletions
@@ -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 <signal.h> - -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 <lib>.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 <signal.h>
+
+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 <lib>.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;
+}
|
