diff options
| -rw-r--r-- | src/hash/blake2.c | 1 | ||||
| -rw-r--r-- | src/io.c | 1 | ||||
| -rw-r--r-- | src/lua.c | 2 | ||||
| -rw-r--r-- | src/lua.h | 49 | ||||
| -rw-r--r-- | src/net/common.h | 3 | ||||
| -rw-r--r-- | src/reg.c | 2 | ||||
| -rw-r--r-- | src/thread.c | 2 | ||||
| -rw-r--r-- | tests/old/buffer.lua (renamed from tests/buffer.lua) | 0 | ||||
| -rw-r--r-- | tests/old/h.lua (renamed from tests/h.lua) | 0 | ||||
| -rw-r--r-- | tests/old/https.lua (renamed from tests/https.lua) | 0 | ||||
| -rw-r--r-- | tests/old/loc.lua (renamed from tests/loc.lua) | 0 | ||||
| -rw-r--r-- | tests/old/match.lua (renamed from tests/match.lua) | 0 | ||||
| -rw-r--r-- | tests/old/net.lua (renamed from tests/net.lua) | 0 | ||||
| -rw-r--r-- | tests/old/net2.lua (renamed from tests/net2.lua) | 0 | ||||
| -rw-r--r-- | tests/old/nets.lua (renamed from tests/nets.lua) | 0 | ||||
| -rw-r--r-- | tests/old/nya.lua (renamed from tests/nya.lua) | 0 | ||||
| -rw-r--r-- | tests/old/req.lua (renamed from tests/req.lua) | 0 | ||||
| -rw-r--r-- | tests/old/s.lua (renamed from tests/s.lua) | 0 | ||||
| -rw-r--r-- | tests/old/t.lua (renamed from tests/t.lua) | 0 | ||||
| -rw-r--r-- | tests/old/thread.lua | 15 | ||||
| -rw-r--r-- | tests/old/wss.lua (renamed from tests/wss.lua) | 0 | ||||
| -rw-r--r-- | tests/thread.lua | 16 |
22 files changed, 26 insertions, 65 deletions
diff --git a/src/hash/blake2.c b/src/hash/blake2.c index 5f38bba..adb1419 100644 --- a/src/hash/blake2.c +++ b/src/hash/blake2.c @@ -3,7 +3,6 @@ #include <string.h>
#include <stdlib.h>
#include "../crypto.h"
-#include "lua5.4/lua.h"
void mix2b(uint64_t* a, uint64_t* b, uint64_t* c, uint64_t* d, int64_t x, int64_t y){
*a = *a + *b + x;
@@ -1,5 +1,4 @@ #include <unistd.h> -#include "lua5.4/lua.h" #include "types/str.h" #include "io.h" #include "stdlib.h" @@ -3,8 +3,8 @@ #include "io.h"
#include <stdlib.h>
#include <string.h>
-#include "lua5.4/lua.h"
#include "types/str.h"
+#include <stdint.h>
#include "types/parray.h"
static int ii = 0;
@@ -76,52 +76,17 @@ int lua_assign_upvalues(lua_State* L, int fidx); int writer(lua_State*, const void*, size_t, void*);
#if LUA_VERSION_NUM == 504
- #define lreg(N, FN)\
- lua_pushstring(L, N);\
- luaL_register(L, NULL, FN);\
- lua_settable(L, -3);
-
-
- #define requiref( L, modname, f, glob ) \
- { luaL_requiref( L, modname, f, glob ); lua_pop( L, 1 ); }
-
#define lua_objlen(L,i) lua_rawlen(L,(i))
- #define luaL_register(L, M, F) luaL_newlib(L, F);
-#else
- //todo: #define luaL_tolstring(L, idx, n) _luaL_tolstring(L, idx, n)
- #define lreg(N, FN)\
- lua_newtable(L);\
- luaL_register(L, NULL, FN);\
- lua_setfield(L, 2, N);
+ #define luaL_register(L, M, F) luaL_newlib(L, F);
+#elif LUA_VERSION_NUM = 501
+ #define luaL_tolstring lua_tolstring
- //taken straight from luaproc
- #define requiref(L, modname, f, glob){\
- lua_pushcfunction(L, f);\
- lua_pushstring(L, modname); \
- lua_call(L, 1, 1);\
- lua_getfield(L, LUA_GLOBALSINDEX, LUA_LOADLIBNAME);\
- if(lua_type(L, -1) == LUA_TTABLE){\
- lua_getfield(L, -1, "loaded");\
- if(lua_type(L, -1) == LUA_TTABLE){\
- lua_getfield(L, -1, modname);\
- if(lua_type(L, -1) == LUA_TNIL) {\
- lua_pushvalue(L, 1);\
- lua_setfield(L, -3, modname);\
- }\
- lua_pop(L, 1);\
- }\
- lua_pop(L, 1);\
- }\
- lua_pop(L, 1);\
- if(glob){\
- lua_setglobal(L, modname);\
- }else{\
- lua_pop(L, 1);\
- }\
- }
-
+ #define lua_dump(A, B, C, D) lua_dump(A, B, C)
+ #define lua_rawlen lua_objlen
+
+ #define lua_gc(A, B) lua_gc(A, B, 0)
#endif
diff --git a/src/net/common.h b/src/net/common.h index 6b1a25a..828cb04 100644 --- a/src/net/common.h +++ b/src/net/common.h @@ -1,9 +1,6 @@ #ifndef __common_net_h #define __common_net_h -#include "lua5.4/lauxlib.h" -#include "lua5.4/lua.h" - #include <sys/types.h> #include <stdio.h> #include <stdlib.h> @@ -26,7 +26,7 @@ static int lua_exit(lua_State* L){ #define open_common(name)\
int luaopen_lullaby_##name (lua_State* L){\
- luaL_register(L, NULL, name##_function_list);\
+ luaL_register(L, #name, name##_function_list);\
int tidx = lua_gettop(L);\
i_config_metatable(L, name##_config);\
lua_settop(L, tidx);\
diff --git a/src/thread.c b/src/thread.c index a6be01b..c5ae933 100644 --- a/src/thread.c +++ b/src/thread.c @@ -1,6 +1,4 @@ #include "thread.h"
-#include "lua5.4/lauxlib.h"
-#include "lua5.4/lua.h"
#include "stdint.h"
#include <stdlib.h>
#include <unistd.h>
diff --git a/tests/buffer.lua b/tests/old/buffer.lua index 3309aed..3309aed 100644 --- a/tests/buffer.lua +++ b/tests/old/buffer.lua diff --git a/tests/h.lua b/tests/old/h.lua index a875b42..a875b42 100644 --- a/tests/h.lua +++ b/tests/old/h.lua diff --git a/tests/https.lua b/tests/old/https.lua index 83c5904..83c5904 100644 --- a/tests/https.lua +++ b/tests/old/https.lua diff --git a/tests/loc.lua b/tests/old/loc.lua index d50b9de..d50b9de 100644 --- a/tests/loc.lua +++ b/tests/old/loc.lua diff --git a/tests/match.lua b/tests/old/match.lua index 000b1e7..000b1e7 100644 --- a/tests/match.lua +++ b/tests/old/match.lua diff --git a/tests/net.lua b/tests/old/net.lua index f5e57f9..f5e57f9 100644 --- a/tests/net.lua +++ b/tests/old/net.lua diff --git a/tests/net2.lua b/tests/old/net2.lua index bb69051..bb69051 100644 --- a/tests/net2.lua +++ b/tests/old/net2.lua diff --git a/tests/nets.lua b/tests/old/nets.lua index a356539..a356539 100644 --- a/tests/nets.lua +++ b/tests/old/nets.lua diff --git a/tests/nya.lua b/tests/old/nya.lua index ca5299c..ca5299c 100644 --- a/tests/nya.lua +++ b/tests/old/nya.lua diff --git a/tests/req.lua b/tests/old/req.lua index 9eb4cf3..9eb4cf3 100644 --- a/tests/req.lua +++ b/tests/old/req.lua diff --git a/tests/s.lua b/tests/old/s.lua index ae84e25..ae84e25 100644 --- a/tests/s.lua +++ b/tests/old/s.lua diff --git a/tests/t.lua b/tests/old/t.lua index 09ee15d..09ee15d 100644 --- a/tests/t.lua +++ b/tests/old/t.lua diff --git a/tests/old/thread.lua b/tests/old/thread.lua new file mode 100644 index 0000000..8b7de88 --- /dev/null +++ b/tests/old/thread.lua @@ -0,0 +1,15 @@ +llby = require "lullaby" + +llby.thread.async(function(res, rej) + print("hi") + a = llby.crypto.sha512() + a:update("hi") + b = a + "meow" + print((b + "hi"):final()) + print((a:update("hi")):final()) + print((b + "hi"):final()) +end) + +os.execute("sleep 1") + + diff --git a/tests/wss.lua b/tests/old/wss.lua index f9ecfbd..f9ecfbd 100644 --- a/tests/wss.lua +++ b/tests/old/wss.lua diff --git a/tests/thread.lua b/tests/thread.lua index 8b7de88..fda3737 100644 --- a/tests/thread.lua +++ b/tests/thread.lua @@ -1,15 +1,3 @@ -llby = require "lullaby" - -llby.thread.async(function(res, rej) - print("hi") - a = llby.crypto.sha512() - a:update("hi") - b = a + "meow" - print((b + "hi"):final()) - print((a:update("hi")):final()) - print((b + "hi"):final()) -end) - -os.execute("sleep 1") - +local llby = require("lullaby") +local b1 = llby |
