Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/synodriver/lua-bencode

lua bencode library, written in C
https://github.com/synodriver/lua-bencode

Last synced: 20 days ago
JSON representation

lua bencode library, written in C

Awesome Lists containing this project

README

        

✨ lua-bencode ✨

The C extension of bencode

```lua
local bencode = require("bencode")

print(bencode.loads("i1233e"))
print(bencode.loads("i-1233e"))
print(bencode.loads("6:string"))
print("---------")
for k,v in pairs(bencode.loads("d3:age9:Ein Verne9:interestsi18e4:namel4:book5:movieee")) do
print(k, v)
if type(v) == "table" then
for k1, v1 in pairs(v) do
print(" ", k1, v1)
end
end
end
print("---------")
for k,v in pairs(bencode.loads("l7:contenti42ee")) do
print(k, v)
end
print(pcall(bencode.loads, "i00e"))

print(bencode.dumps({1,2,3, "3141"}))
print(bencode.dumps({["123"]="ddsaf", ["1243"]=12}, 100000))
```