diff options
| author | ame <[email protected]> | 2024-07-11 18:51:15 -0500 |
|---|---|---|
| committer | ame <[email protected]> | 2024-07-11 18:51:15 -0500 |
| commit | e3af5c593585af11b61e8c467311bc7c31035855 (patch) | |
| tree | 567943db6f3d265927b232a5f95a58d45eb6eec7 | |
| parent | 42838a87b8f49db2ae5781498edf4192c61a21a6 (diff) | |
name change and docs
| -rw-r--r-- | docs/readme.md | 4 | ||||
| -rw-r--r-- | makefile | 2 | ||||
| -rw-r--r-- | readme.md | 35 | ||||
| -rw-r--r-- | src/reg.c | 2 |
4 files changed, 38 insertions, 5 deletions
diff --git a/docs/readme.md b/docs/readme.md index 9fbb022..c9aa7d7 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -1,10 +1,10 @@ -# lualib (llib)
+# lullaby (llib)
(name subject to change)
with the library in the same directory [(or one of the other valid search locations)](https://www.lua.org/pil/8.1.html)
```lua
-llib = require "llib"
+llib = require "lullaby"
```
returns a table has many subtables and functions, with related function in them, you can view them like so
@@ -3,7 +3,7 @@ CFLAGS := -fPIC LFLAGS := -lm -shared
LINKER := clang
-TARGET := llib.so
+TARGET := lullaby.so
SRCS := $(wildcard src/*.c) $(wildcard src/*/*.c)
OBJS := $(SRCS:.c=.o)
@@ -1,4 +1,37 @@ -build with `make`, output is `./llib.so` or (win)`./llib.dll`
+## lullaby
+
+> a large multi-purpose library for lua (primarily 5.4) revolving around threading and cryptography, and including network, math, io, and table functions
+
+heres an example of a webserver to return a sha0 hash of an input
+
+<blockquote>
+
+```lua
+llib = require "lullaby"
+local port = 8080
+MAX_LENGTH = 2048
+
+llib.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 = llib.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()
+ --send the hash to the client, closes connection, but thread is live until it ends
+ res:send(hash)
+ end)
+
+end, port)
+```
+
+</blockquote>
+
+build with `make`, output is `./lullaby.so` or (win)`./lullaby.dll`
windows works through msys2
@@ -23,7 +23,7 @@ static int lua_exit(lua_State* L){ return 0;
}
-int luaopen_llib(lua_State* L) {
+int luaopen_lullaby(lua_State* L) {
lua_newuserdata(L, 1);
int ud = lua_gettop(L);
lua_newtable(L);
|
