Skip to content

TechHog8984/bitreader.luau

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bitreader.luau

A read-only wrapper for luau buffers

Why use bitreader?

  • bitreader keeps track of its offset
  • bitreader has a readvarint function for luau bytecode (as well as other tools that serve as an example. see luau)

Usage

Create a bitreader with bitreader.frombuffer or bitreader.fromstring:

bitreader.frombuffer(data: buffer, string_len_func: ((...any) -> ...any)?) : bitreader
bitreader.fromstring(data: string, string_len_func: ((...any) -> ...any)?) : bitreader

string_len_func is optional and will be used to get the string's length in bitreader:readstring (if the length argument is omitted)

its default is bitreader:readvarint

Methods

Bitreader wraps all buffer read methods as well as tostring and len.

See https://create.roblox.com/docs/reference/engine/libraries/buffer for more info

bitreader:readvarint(): number
  • bitreader:readstring reads a string that is a certain length. If there is no length argument, string_len_func will be called (see Usage)
bitreader:readstring(length: number?): number

About

A read-only wrapper for luau buffers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages