summaryrefslogtreecommitdiff
path: root/meta/3rd/OpenResty/library/resty.string.lua
diff options
context:
space:
mode:
authorMichael Martin <flrgh@protonmail.com>2021-12-21 17:58:03 -0800
committerMichael Martin <flrgh@protonmail.com>2021-12-21 18:02:15 -0800
commit764074d764d901065e353d68f1c5d0a78ec3a6c6 (patch)
tree942d4f3fe2075c1705efa9d6a61c6b69b6f42ea9 /meta/3rd/OpenResty/library/resty.string.lua
parent19591ff2f4a05fcadb574c0fc588325e217bd3ff (diff)
downloadlua-language-server-764074d764d901065e353d68f1c5d0a78ec3a6c6.zip
chore: update/cleanup resty.string annotations
Diffstat (limited to 'meta/3rd/OpenResty/library/resty.string.lua')
-rw-r--r--meta/3rd/OpenResty/library/resty.string.lua79
1 files changed, 74 insertions, 5 deletions
diff --git a/meta/3rd/OpenResty/library/resty.string.lua b/meta/3rd/OpenResty/library/resty.string.lua
index 9931b0ec..e9852da8 100644
--- a/meta/3rd/OpenResty/library/resty.string.lua
+++ b/meta/3rd/OpenResty/library/resty.string.lua
@@ -1,6 +1,75 @@
---@meta
-resty_string={}
-function resty_string.to_hex(s) end
-resty_string._VERSION="0.11"
-function resty_string.atoi(s) end
-return resty_string \ No newline at end of file
+
+--- OpenResty string functions.
+--- https://github.com/openresty/lua-resty-string
+local str = {
+ _VERSION = "0.14",
+}
+
+
+--- Encode byte string in hexidecimal.
+---
+--- This is most useful for retrieving a printable string from a checksum
+--- result.
+---
+--- Usage:
+---
+---```lua
+--- local str = require "resty.string"
+--- local md5 = require "resty.md5"
+---
+--- local sum = md5:new()
+--- sum:update("hello")
+--- sum:update("goodbye")
+--- local digest = sum:final()
+--- print(str.to_hex(digest)) --> 441add4718519b71e42d329a834d6d5e
+---```
+---@param s string
+---@return string hex
+function str.to_hex(s) end
+
+--- Convert an ASCII string to an integer.
+---
+--- If the string is not numeric, `-1` is returned.
+---
+--- Usage:
+---
+---```lua
+--- local str = require "resty.string"
+--- print(str.atoi("250")) --> 250
+--- print(str.atoi("abc")) --> -1
+---```
+---
+---@param s string
+---@return number
+function str.atoi(s) end
+
+
+--- A lua-resty-string checksum object.
+---@class resty.string.checksum : table
+local checksum = {
+ _VERSION = str._VERSION,
+}
+
+--- Create a new checksum object.
+---@return resty.string.checksum?
+function checksum:new() end
+
+--- Add a string to the checksum data.
+---
+--- This can be called multiple times.
+---
+---@param s string
+---@return boolean ok
+function checksum:update(s) end
+
+--- Calculate the final checksum.
+---@return string? digest
+function checksum:final() end
+
+--- Reset the checksum object.
+---@return boolean ok
+function checksum:reset() end
+
+
+return str \ No newline at end of file