From 009eb7d43d9582856c275ad3b16f7e3ff94209cc Mon Sep 17 00:00:00 2001 From: amelia squires Date: Wed, 16 Apr 2025 13:09:46 -0500 Subject: merge thingy --- src/hash/blake2.c | 1 - src/io.c | 1 - src/lua.c | 2 +- src/lua.h | 49 +++++---------------------------- src/net/common.h | 3 -- src/reg.c | 2 +- src/thread.c | 2 -- tests/buffer.lua | 9 ------ tests/h.lua | 11 -------- tests/https.lua | 5 ---- tests/loc.lua | 15 ---------- tests/match.lua | 42 ---------------------------- tests/net.lua | 78 ---------------------------------------------------- tests/net2.lua | 24 ---------------- tests/nets.lua | 8 ------ tests/nya.lua | 8 ------ tests/old/buffer.lua | 9 ++++++ tests/old/h.lua | 11 ++++++++ tests/old/https.lua | 5 ++++ tests/old/loc.lua | 15 ++++++++++ tests/old/match.lua | 42 ++++++++++++++++++++++++++++ tests/old/net.lua | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/old/net2.lua | 24 ++++++++++++++++ tests/old/nets.lua | 8 ++++++ tests/old/nya.lua | 8 ++++++ tests/old/req.lua | 11 ++++++++ tests/old/s.lua | 15 ++++++++++ tests/old/t.lua | 15 ++++++++++ tests/old/thread.lua | 15 ++++++++++ tests/old/wss.lua | 22 +++++++++++++++ tests/req.lua | 11 -------- tests/s.lua | 15 ---------- tests/t.lua | 15 ---------- tests/thread.lua | 16 ++--------- tests/wss.lua | 22 --------------- 35 files changed, 289 insertions(+), 328 deletions(-) delete mode 100644 tests/buffer.lua delete mode 100644 tests/h.lua delete mode 100644 tests/https.lua delete mode 100644 tests/loc.lua delete mode 100644 tests/match.lua delete mode 100644 tests/net.lua delete mode 100644 tests/net2.lua delete mode 100644 tests/nets.lua delete mode 100644 tests/nya.lua create mode 100644 tests/old/buffer.lua create mode 100644 tests/old/h.lua create mode 100644 tests/old/https.lua create mode 100644 tests/old/loc.lua create mode 100644 tests/old/match.lua create mode 100644 tests/old/net.lua create mode 100644 tests/old/net2.lua create mode 100644 tests/old/nets.lua create mode 100644 tests/old/nya.lua create mode 100644 tests/old/req.lua create mode 100644 tests/old/s.lua create mode 100644 tests/old/t.lua create mode 100644 tests/old/thread.lua create mode 100644 tests/old/wss.lua delete mode 100644 tests/req.lua delete mode 100644 tests/s.lua delete mode 100644 tests/t.lua delete mode 100644 tests/wss.lua 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 #include #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; diff --git a/src/io.c b/src/io.c index 6cc9e50..0f19933 100644 --- a/src/io.c +++ b/src/io.c @@ -1,5 +1,4 @@ #include -#include "lua5.4/lua.h" #include "types/str.h" #include "io.h" #include "stdlib.h" diff --git a/src/lua.c b/src/lua.c index b87682d..d122b59 100644 --- a/src/lua.c +++ b/src/lua.c @@ -3,8 +3,8 @@ #include "io.h" #include #include -#include "lua5.4/lua.h" #include "types/str.h" +#include #include "types/parray.h" static int ii = 0; diff --git a/src/lua.h b/src/lua.h index 3d58124..cc7a37f 100644 --- a/src/lua.h +++ b/src/lua.h @@ -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 #include #include diff --git a/src/reg.c b/src/reg.c index 64a2c2f..98419bc 100644 --- a/src/reg.c +++ b/src/reg.c @@ -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 #include diff --git a/tests/buffer.lua b/tests/buffer.lua deleted file mode 100644 index 3309aed..0000000 --- a/tests/buffer.lua +++ /dev/null @@ -1,9 +0,0 @@ -llby = require "lullaby" - -b = llby.thread.buffer(llby.crypto.md5()) - -print(b.update(b:get(), "meow"):final()) -print(b.update(b:get(), "meow"):final()) -b:mod(function(this) return this:update("meow") end) -print(b.update(b:get(), "meow"):final()) - diff --git a/tests/h.lua b/tests/h.lua deleted file mode 100644 index a875b42..0000000 --- a/tests/h.lua +++ /dev/null @@ -1,11 +0,0 @@ -llib = require "lullaby" -llib.io.print_meta = 1 - -local a = llib.crypto.sha1() - -local b = llib.thread.buffer(a) - -llib.io.pprint(a) -llib.io.pprint(b:get()) -llib.io.pprint((b + "meow"):final()) - diff --git a/tests/https.lua b/tests/https.lua deleted file mode 100644 index 83c5904..0000000 --- a/tests/https.lua +++ /dev/null @@ -1,5 +0,0 @@ -llby = require"lullaby" - -val, ext = llby.net.srequest("https://amyy.cc/") -llby.io.pprint(val) -llby.io.pprint(ext) diff --git a/tests/loc.lua b/tests/loc.lua deleted file mode 100644 index d50b9de..0000000 --- a/tests/loc.lua +++ /dev/null @@ -1,15 +0,0 @@ -llby = require "lullaby" - -local nya = "mya" -uwu = "bye" -local _o = _G -_G.ooo = "mya" -print(_o.ooo) -local owo = "hi" - -function a() - local meo = "a" - llby.test.stack_dump() -end - -a() diff --git a/tests/match.lua b/tests/match.lua deleted file mode 100644 index 000b1e7..0000000 --- a/tests/match.lua +++ /dev/null @@ -1,42 +0,0 @@ -llb = require "lullaby" - -function test(a, b, match, expect) - res, out = llb.test._match(a, b) - - if res == 0 and res == match then return end - - if res ~= match then - return llb.io.error(a..":"..b.." res("..res..") != expected") - end - - if res == 0 then - return llb.io.error(a..":"..b.." res == match") - end - - if llb.array.len(out) ~= llb.array.len(expect) then - return llb.io.error("out != expect") - end - - for i, v in ipairs(expect) do - if v ~= out[i] then - return llb.io.error("out != expect") - end - end -end - -test("/{test}/","/name/", 1, {test="name"}) -test("/", "/wawawawawawaw", 0) -test("*","/wdejowe/wde", 1, {}) -test("/*/{hello}/{meow}/end","/blah/blah/hii/end", 1, {hello="blah", meow="hii"}) -test("/*/*/{test}/*/*/end/*/real","/a/b/testing/d/e/end/f/real", 1, {test="testing"}) -test("/*/a/b/end/{word}","/w/o/m/p/a/b/end/meow", 1, {word="meow"}) -test("*", "meow/meow/meow", 1, {}) -test("{meow}", "owo", 1, {meow="owo"}) -test("/{meow}", "/owo", 1, {meow="owo"}) -test("{meow}", "/", 0) -test("/{meow}", "/", 0) -test("/*/", "/test", 0) -test("/{meow}/", "/aw", 0) ---i dont know if this should be valid, but idc -test("/{meow}/", "//", 1, {meow=""}) - diff --git a/tests/net.lua b/tests/net.lua deleted file mode 100644 index f5e57f9..0000000 --- a/tests/net.lua +++ /dev/null @@ -1,78 +0,0 @@ ---yes, this is kinda a mess of requires, just proof it works:3 -net = require "lullaby.net" -local io = require "lullaby.io" -local crypto = require "lullaby.crypto" - -io.max_depth = 5 - -sleep = function(a) - local sec = tonumber(os.clock() + a); - while (os.clock() < sec) do - end -end - -net.listen( - function(server) - - io.pprint("online") - _G.server = server - - server:POST("/{name}", function(res, req) - eroifjeor() - --print("name is "..req.name) - print("name") - io.pprint(req.parameters) - res:stop() - end) - - server:all("/{name}/nya/{user}", function(res, req) - --print("name is "..req.name) - print("name user") - io.pprint(req.parameters) - end) - - server:all("*", function(res, req) - print("all") - io.pprint(req.parameters) - end) - - server:all("/{name}/user/*/{id}", function(res, req) - print("owo") - io.pprint(req.parameters) - - end) - - server:all("/", function(res, req) - b = crypto.md5("hello") - - res:send(b) - - a = req:roll() - - while a > -1 do - a = req:roll() - print(req._bytes .. "/" .. req["Content-Length"]) - end - io.pprint(req) - - end) - - server:GET("/aa", function(res, req) - --res.header["Content-Type"] = "text/plain" - res:sendfile("readme.md", {attachment=true}) - end) - - server:GET("/test55", function(res, req) - res.Code = 403 - res:send("

you would never

") - end) - - server:GET("/error", function(res, req) - res.a.a.a.a() - end) - - - - end, - arg[1] -) diff --git a/tests/net2.lua b/tests/net2.lua deleted file mode 100644 index bb69051..0000000 --- a/tests/net2.lua +++ /dev/null @@ -1,24 +0,0 @@ ---(this is in tests/net2.lua) -net = require "lullaby.net" -local crypto = require "lullaby.crypto" -local port = 8080 -MAX_LENGTH = 2048 - -net.listen(function(server) - - --listen to post requests at localhost:8080 (root directory) - server:POST("/", function(res, req) - --creates a sha0 hash object - local hash = crypto.sha0() - --loads an extra 2048 characters from the request body (the body is not guaranteed to be >= 2048 characters, reasoning in docs) - req:roll(MAX_LENGTH) - - --incremental hashes allow updating via addition, in this case adding the body and getting a string from it - hash = (hash + req.Body):final() - print(hash, crypto) - --send the hash to the client, closes connection, but thread is live until it ends - res:send(hash) - end) - -end, port) - diff --git a/tests/nets.lua b/tests/nets.lua deleted file mode 100644 index a356539..0000000 --- a/tests/nets.lua +++ /dev/null @@ -1,8 +0,0 @@ -llby = require"lullaby" - -llby.net.listen(function(server) - server:GET("/", function(res, req) - res:sendfile("license.md") - --res:sendfile("../awa/static/volcarona.gif") - end) -end, 8888) diff --git a/tests/nya.lua b/tests/nya.lua deleted file mode 100644 index ca5299c..0000000 --- a/tests/nya.lua +++ /dev/null @@ -1,8 +0,0 @@ -llby = require "lullaby" - -llby.net.listen(function(server) - server:GET("/", function(res, req) - print("hi") - llby.io.pprint(req) - end) -end, 8887) diff --git a/tests/old/buffer.lua b/tests/old/buffer.lua new file mode 100644 index 0000000..3309aed --- /dev/null +++ b/tests/old/buffer.lua @@ -0,0 +1,9 @@ +llby = require "lullaby" + +b = llby.thread.buffer(llby.crypto.md5()) + +print(b.update(b:get(), "meow"):final()) +print(b.update(b:get(), "meow"):final()) +b:mod(function(this) return this:update("meow") end) +print(b.update(b:get(), "meow"):final()) + diff --git a/tests/old/h.lua b/tests/old/h.lua new file mode 100644 index 0000000..a875b42 --- /dev/null +++ b/tests/old/h.lua @@ -0,0 +1,11 @@ +llib = require "lullaby" +llib.io.print_meta = 1 + +local a = llib.crypto.sha1() + +local b = llib.thread.buffer(a) + +llib.io.pprint(a) +llib.io.pprint(b:get()) +llib.io.pprint((b + "meow"):final()) + diff --git a/tests/old/https.lua b/tests/old/https.lua new file mode 100644 index 0000000..83c5904 --- /dev/null +++ b/tests/old/https.lua @@ -0,0 +1,5 @@ +llby = require"lullaby" + +val, ext = llby.net.srequest("https://amyy.cc/") +llby.io.pprint(val) +llby.io.pprint(ext) diff --git a/tests/old/loc.lua b/tests/old/loc.lua new file mode 100644 index 0000000..d50b9de --- /dev/null +++ b/tests/old/loc.lua @@ -0,0 +1,15 @@ +llby = require "lullaby" + +local nya = "mya" +uwu = "bye" +local _o = _G +_G.ooo = "mya" +print(_o.ooo) +local owo = "hi" + +function a() + local meo = "a" + llby.test.stack_dump() +end + +a() diff --git a/tests/old/match.lua b/tests/old/match.lua new file mode 100644 index 0000000..000b1e7 --- /dev/null +++ b/tests/old/match.lua @@ -0,0 +1,42 @@ +llb = require "lullaby" + +function test(a, b, match, expect) + res, out = llb.test._match(a, b) + + if res == 0 and res == match then return end + + if res ~= match then + return llb.io.error(a..":"..b.." res("..res..") != expected") + end + + if res == 0 then + return llb.io.error(a..":"..b.." res == match") + end + + if llb.array.len(out) ~= llb.array.len(expect) then + return llb.io.error("out != expect") + end + + for i, v in ipairs(expect) do + if v ~= out[i] then + return llb.io.error("out != expect") + end + end +end + +test("/{test}/","/name/", 1, {test="name"}) +test("/", "/wawawawawawaw", 0) +test("*","/wdejowe/wde", 1, {}) +test("/*/{hello}/{meow}/end","/blah/blah/hii/end", 1, {hello="blah", meow="hii"}) +test("/*/*/{test}/*/*/end/*/real","/a/b/testing/d/e/end/f/real", 1, {test="testing"}) +test("/*/a/b/end/{word}","/w/o/m/p/a/b/end/meow", 1, {word="meow"}) +test("*", "meow/meow/meow", 1, {}) +test("{meow}", "owo", 1, {meow="owo"}) +test("/{meow}", "/owo", 1, {meow="owo"}) +test("{meow}", "/", 0) +test("/{meow}", "/", 0) +test("/*/", "/test", 0) +test("/{meow}/", "/aw", 0) +--i dont know if this should be valid, but idc +test("/{meow}/", "//", 1, {meow=""}) + diff --git a/tests/old/net.lua b/tests/old/net.lua new file mode 100644 index 0000000..f5e57f9 --- /dev/null +++ b/tests/old/net.lua @@ -0,0 +1,78 @@ +--yes, this is kinda a mess of requires, just proof it works:3 +net = require "lullaby.net" +local io = require "lullaby.io" +local crypto = require "lullaby.crypto" + +io.max_depth = 5 + +sleep = function(a) + local sec = tonumber(os.clock() + a); + while (os.clock() < sec) do + end +end + +net.listen( + function(server) + + io.pprint("online") + _G.server = server + + server:POST("/{name}", function(res, req) + eroifjeor() + --print("name is "..req.name) + print("name") + io.pprint(req.parameters) + res:stop() + end) + + server:all("/{name}/nya/{user}", function(res, req) + --print("name is "..req.name) + print("name user") + io.pprint(req.parameters) + end) + + server:all("*", function(res, req) + print("all") + io.pprint(req.parameters) + end) + + server:all("/{name}/user/*/{id}", function(res, req) + print("owo") + io.pprint(req.parameters) + + end) + + server:all("/", function(res, req) + b = crypto.md5("hello") + + res:send(b) + + a = req:roll() + + while a > -1 do + a = req:roll() + print(req._bytes .. "/" .. req["Content-Length"]) + end + io.pprint(req) + + end) + + server:GET("/aa", function(res, req) + --res.header["Content-Type"] = "text/plain" + res:sendfile("readme.md", {attachment=true}) + end) + + server:GET("/test55", function(res, req) + res.Code = 403 + res:send("

you would never

") + end) + + server:GET("/error", function(res, req) + res.a.a.a.a() + end) + + + + end, + arg[1] +) diff --git a/tests/old/net2.lua b/tests/old/net2.lua new file mode 100644 index 0000000..bb69051 --- /dev/null +++ b/tests/old/net2.lua @@ -0,0 +1,24 @@ +--(this is in tests/net2.lua) +net = require "lullaby.net" +local crypto = require "lullaby.crypto" +local port = 8080 +MAX_LENGTH = 2048 + +net.listen(function(server) + + --listen to post requests at localhost:8080 (root directory) + server:POST("/", function(res, req) + --creates a sha0 hash object + local hash = crypto.sha0() + --loads an extra 2048 characters from the request body (the body is not guaranteed to be >= 2048 characters, reasoning in docs) + req:roll(MAX_LENGTH) + + --incremental hashes allow updating via addition, in this case adding the body and getting a string from it + hash = (hash + req.Body):final() + print(hash, crypto) + --send the hash to the client, closes connection, but thread is live until it ends + res:send(hash) + end) + +end, port) + diff --git a/tests/old/nets.lua b/tests/old/nets.lua new file mode 100644 index 0000000..a356539 --- /dev/null +++ b/tests/old/nets.lua @@ -0,0 +1,8 @@ +llby = require"lullaby" + +llby.net.listen(function(server) + server:GET("/", function(res, req) + res:sendfile("license.md") + --res:sendfile("../awa/static/volcarona.gif") + end) +end, 8888) diff --git a/tests/old/nya.lua b/tests/old/nya.lua new file mode 100644 index 0000000..ca5299c --- /dev/null +++ b/tests/old/nya.lua @@ -0,0 +1,8 @@ +llby = require "lullaby" + +llby.net.listen(function(server) + server:GET("/", function(res, req) + print("hi") + llby.io.pprint(req) + end) +end, 8887) diff --git a/tests/old/req.lua b/tests/old/req.lua new file mode 100644 index 0000000..9eb4cf3 --- /dev/null +++ b/tests/old/req.lua @@ -0,0 +1,11 @@ +local awa = require "lullaby" + +print(awa.net.srequest("amyy.cc", "/", "meow").content) + +--awa.net.srequest("example.com", "/", "meow") + +--[[ + +net.srequest("example.com", "/", {key="meow"}, {Header="value"}) + +]]-- diff --git a/tests/old/s.lua b/tests/old/s.lua new file mode 100644 index 0000000..ae84e25 --- /dev/null +++ b/tests/old/s.lua @@ -0,0 +1,15 @@ +local t = function (a) end + +llib = require "llib" + +local a = llib.crypto.md5() +--llib.io.pprint(_ENV.a) + +for i = 1,200 do + awa = function(a) end + llib.thread.async(awa):await() +end + +if a:final() ~= "d41d8cd98f00b204e9800998ecf8427e" then + print(a:final()) +end diff --git a/tests/old/t.lua b/tests/old/t.lua new file mode 100644 index 0000000..09ee15d --- /dev/null +++ b/tests/old/t.lua @@ -0,0 +1,15 @@ +a = require "lullaby" + +b = coroutine.create(function() + os.execute("sleep 2") + print("co") +end) + +c = a.thread.async(function(res, req) + coroutine.resume(b) +end) + +os.execute("sleep 0.5") +print("owo") + +c:await() 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/old/wss.lua b/tests/old/wss.lua new file mode 100644 index 0000000..f9ecfbd --- /dev/null +++ b/tests/old/wss.lua @@ -0,0 +1,22 @@ +llby = require("lullaby") + +local ws, error = llby.net.wss("echo.websocket.org:4432") + +if ws == nil then + print(error) + os.exit(12) +end + +print(ws) + +for i=1,10 do + local c = ws:read().content + print(c) + ws:write(c.."a") +end + +ws:close() +ws:close() + +--ws:ping() +--add onclose? diff --git a/tests/req.lua b/tests/req.lua deleted file mode 100644 index 9eb4cf3..0000000 --- a/tests/req.lua +++ /dev/null @@ -1,11 +0,0 @@ -local awa = require "lullaby" - -print(awa.net.srequest("amyy.cc", "/", "meow").content) - ---awa.net.srequest("example.com", "/", "meow") - ---[[ - -net.srequest("example.com", "/", {key="meow"}, {Header="value"}) - -]]-- diff --git a/tests/s.lua b/tests/s.lua deleted file mode 100644 index ae84e25..0000000 --- a/tests/s.lua +++ /dev/null @@ -1,15 +0,0 @@ -local t = function (a) end - -llib = require "llib" - -local a = llib.crypto.md5() ---llib.io.pprint(_ENV.a) - -for i = 1,200 do - awa = function(a) end - llib.thread.async(awa):await() -end - -if a:final() ~= "d41d8cd98f00b204e9800998ecf8427e" then - print(a:final()) -end diff --git a/tests/t.lua b/tests/t.lua deleted file mode 100644 index 09ee15d..0000000 --- a/tests/t.lua +++ /dev/null @@ -1,15 +0,0 @@ -a = require "lullaby" - -b = coroutine.create(function() - os.execute("sleep 2") - print("co") -end) - -c = a.thread.async(function(res, req) - coroutine.resume(b) -end) - -os.execute("sleep 0.5") -print("owo") - -c:await() 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 diff --git a/tests/wss.lua b/tests/wss.lua deleted file mode 100644 index f9ecfbd..0000000 --- a/tests/wss.lua +++ /dev/null @@ -1,22 +0,0 @@ -llby = require("lullaby") - -local ws, error = llby.net.wss("echo.websocket.org:4432") - -if ws == nil then - print(error) - os.exit(12) -end - -print(ws) - -for i=1,10 do - local c = ws:read().content - print(c) - ws:write(c.."a") -end - -ws:close() -ws:close() - ---ws:ping() ---add onclose? -- cgit v1.2.3