Skip to content

Latest commit

 

History

History
37 lines (24 loc) · 629 Bytes

readme.md

File metadata and controls

37 lines (24 loc) · 629 Bytes

netstring

Encode and decode netstrings.

Install

luarocks install ers35/netstring

Usage

netstring.encode(decoded)

Encode a netstring.

local encoded = netstring.encode("hello")

netstring.decode(encoded)

Decode a netstring.

local decoded, remainder = netstring.decode("5:hello,5:world,")

netstring.gdecode(encoded)

Returns an iterator function that, each time it is called, returns the next decoded string from encoded.

local encoded = "5:hello,5:world,"
for decoded in netstring.gdecode(encoded) do
	print(decoded)
end