diff options
| author | ame <[email protected]> | 2025-06-17 00:25:14 -0500 |
|---|---|---|
| committer | ame <[email protected]> | 2025-06-17 00:25:14 -0500 |
| commit | e058a29d70dd299b7fc2a84cae5824fd03fbef84 (patch) | |
| tree | cf7d7937d04f49a02e1092541f6ab5c53e853b12 | |
| parent | c98308b44764483322df9c4cf6ec9187669a5f00 (diff) | |
more docs
| -rw-r--r-- | docs/net/request.md | 29 | ||||
| -rw-r--r-- | docs/net/websocket.md | 4 | ||||
| -rw-r--r-- | docs/readme.md | 33 |
3 files changed, 61 insertions, 5 deletions
diff --git a/docs/net/request.md b/docs/net/request.md new file mode 100644 index 0000000..3d03d84 --- /dev/null +++ b/docs/net/request.md @@ -0,0 +1,29 @@ +## request + +net.request(url, content, header, request)** +net.srequest(url, content, header, request) + +both function identically, where srequest uses https instead of http + +content is a string with the body of the request + +header is just a table + +request is just the request method, ie: GET, PUT, ... + +will call each other when the url protocol mismatches the function + +can return an error + +```lua +local response = net.srequest("https://amyy.cc") +``` + +the response is a table consisting of the response headers with a few extra values + +|name|description| +| -- | -- | +| code | response code | +| code-name | response code string | +| version | http version | +| content | a stream containing the body of the request | diff --git a/docs/net/websocket.md b/docs/net/websocket.md index 5a82a70..f64f80a 100644 --- a/docs/net/websocket.md +++ b/docs/net/websocket.md @@ -11,11 +11,11 @@ can return an error ```lua net.wss("amyy.cc") -- connects to wss://amyy.cc -net.wss("ws://amyy.cc") -- identical to net.wss("amyy.cc" +net.wss("ws://amyy.cc") -- identical to net.wss("amyy.cc") ``` ```lua -local con = new.ws("amyy.cc") +local con = net.ws("amyy.cc") while true do local frame = con:read() diff --git a/docs/readme.md b/docs/readme.md index 26fc5cb..9436ba0 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -1,16 +1,16 @@ -# lullaby (llib)
+# lullaby (llby)
(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 "lullaby"
+llby = require "lullaby"
```
returns a table has many subtables and functions, with related function in them, you can view them like so
```lua
-llib.io.pprint(llib) --pprint is a part of the io module, pprint meaning pretty print
+llby.io.pprint(llby) --pprint is a part of the io module, pprint meaning pretty print
```
all subtables and functions have a corresponding file in this directory on usage
@@ -22,6 +22,33 @@ crypto = require "lullaby.crypto" crypto.sha224()
```
+### configuration
+
+modules will each have different values you can change
+
+each individual function will list what values you can modify, but all of them will exist in the parent table
+
+```lua
+llby.net.mimetypes = "/etc/meow"
+```
+
+## common functions/utils
+
+### stream
+
+streams allow generating a string in smaller chunks to save on memory
+
+currently can only be made in c using luaI_newstream
+
+stream:file(filename, bytes?)
+stream:read(bytes?)
+
+both function identically, file sending the data to a file and read returning it
+
+the number of bytes can be selected, the function will return an amount close to what was requested
+
+some streams may not support the bytes param, and may just ignore it. if it is ignored or not given it will always read the entire stream
+
---
## big changes
|
