Skip to content

bitcoinsc1/bytebuffer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

Bytebuffer

Dependencies:

Luvit or any bitop lib

Examples

Code

local bb = require('bytebuffer')

local buf = bb()
buf:WriteIntLE(-123, 8)

local buf2 = bb(tostring(buf))
print(buf2:ReadIntLE(8))

Also used in my other repositories

Source Query Protocol
RCON Protocol

Featured functions

Write

:WriteByte(:number)
:WriteUIntLE(:number, :bitcount[8, 16, 24, 32])
:WriteUIntBE(:number, :bitcount[8, 16, 24, 32])
:WriteIntLE(:number, :bitcount[8, 16, 24, 32])
:WriteIntBE(:number, :bitcount[8, 16, 24, 32])
:WriteString(:string)

Read

:ReadByte()
:ReadChar() -- interpret byte as char
:ReadUIntLE(:bitcount[8, 16, 24, 32])
:ReadUIntBE(:bitcount[8, 16, 24, 32])
:ReadIntLE(:bitcount[8, 16, 24, 32])
:ReadIntBE(:bitcount[8, 16, 24, 32])
:ReadString()

Other

:ToString()

WARNING!

It's NOT a bitbuffer, it can only work with bytes (which consist of 8 bits)

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages