Quantcast
Download
(6 Kb)
Download
Updated: 09/19/19 01:54 PM
Pictures
File Info
Compatibility:
Dragonhold (5.2.0)
Scalebreaker (5.1.5)
Elsweyr (5.0.5)
Updated:09/19/19 01:54 PM
Created:03/19/17 11:40 PM
Monthly downloads:35,884
Total downloads:235,760
Favorites:215
MD5:
5.1.5
LibBinaryEncode  Popular! (More than 5000 hits)
Version: 1.20
by: Rhyono [More]
This library compresses binary data.

It provides custom base-256 and base-64 encodings, specially tailored to ESO's character set support.

Main Functions

Prefixing
If your addon intends to read the data from a publicly visible source such as a guild note, mail, chat, etc. you will need a way to know that it is your message. If you are using it as internal storage, then you can totally skip this section and move on to Encoding and Decoding and ignore the optional parameters.

Important note: always define prefixes as early as possible in your addon. Keep in mind that you want someone that is receiving the data to also already have the prefix defined. If you wait until you're sending data to define a prefix, if person B doesn't perform X (because they are receiving, not sending): they won't be able to receive.

lua Code:
  1. LBE:DefinePrefix(prefix, addonName, purpose,<optional> base,<optional> schema)

Warning: Spoiler


Parsing
If your data source is not guaranteed to be purely your data, this will trim it out and give you back a comprehensive table.

lua Code:
  1. LBE:Parse(text_string,<optional> addonName,<optional> purpose,<optional> dataToString, <optional> firstOnly) OR
  2. LBE:ParseDataToString(text_string,<optional> addonName,<optional> purpose) OR
  3. LBE:ParseFirst(text_string,<optional> addonName,<optional> purpose,<optional> dataToString) OR
  4. LBE:ParseFirstDataToString(text_string,<optional> addonName,<optional> purpose)

Warning: Spoiler


Additional Functions

Warning: Spoiler


How to Include
It is recommended to have users download the library directly. If you want to include it, all you have to do is include the entire folder as is.

In your addon, simply add this line
Code:
## DependsOn: LibBinaryEncode>=20
To view examples and test out the functions, install: LBE Test

Compression Size
Regardless of selection, keep in mind the byte size of your prefix (if applicable), the prefix glue is 2 bytes (only applicable if using a prefix) and the check digit is 1 byte.

Base 256
The final size is affected by several factors. ESO measures input by characters but saved data by byte. Some of the characters in the encoding are 2 bytes, so the ratio is not always 8:1. The byte size can be checked with # before attempting to send/save it to a location of limited data.

Base 64
This uses purely single byte characters. As such, you can expect a consistent 6:1 ratio.

Help
Are you interested but have no idea where to start? Send me a PM and I can easily assess whether LBE will do what you want and how difficult it would be to do.
Version 1.20 - API Bump

Version 1.19
*API Bump
*Added ConcatTables

Version 1.18 - Added IsLibrary flag
Version 1.17 - API bump

Version 1.16
*Added partial validation to encoding to prevent non-schema indexes from being included
*Removed decode and encode (lowercase)
*Decode and Parse now default to table output
*Added DecodeToString
*Added DecodeToString64
*Added ParseDataToString
*Added ParseFirstDataToString

Version 1.15
*Changed insufficient data for schema to fill to the best of its ability and use false for the remainder
*Added Parse being able to specifically return first prefix found
*Added ParseFirst
*Added ParseFirstDataToTable
*Added ConvertSchema
*Added CloneSchema

Version 1.14
*Replaced non-parsing characters in base-256 encoding. Previously encoded strings may fail to parse.

Version 1.13
*Added schema to multiple functions
*Added ConvertTable to convert auto-indexed ID tables to schema-ready tables
*Added support for 1 and 2 dimensional numeric tables
*Added schema extractor and sorters
*Fixed LBE:IsTrue and LBE:NumBool not returning a value
*DecodeToTable now uses schema to generate table data
*DecodeToTable64 now inherits from DecodeToTable
*Disallowed updating a prefix after defining it
*Boolean addon names and purposes are now disallowed

Version 1.12
*Added custom base 64 encoding
*Added Encode64, Decode64, DecodeToTable64
*Added base parameter and awareness to multiple functions

Version 1.11
*Added automatic encoding glue when using a prefix
*Added check digit to ensure decoding length

Version 1.10
*Removed LibStub dependency
*Added Decode and Encode aliases
*Moved table output decode to DecodeToTable
*DecodeToTable uses boolean return values instead of strings
*Improved SplitString
*Added SplitBooleanString
*Added DefinePrefix
*Added support for custom prefixes in Encode and Decode
*Added Parse and ParseDataToTable for taking strings that are not pure data

Version 1.09
*API bump
*Added AddOnVersion

Version 1.08 - API bump
Version 1.07 - API bump
Version 1.06 - API bump
Version 1.05 - API bump
Version 1.04 - API bump

Version 1.03
*Changed string 0 to evaluate false.
*Added strict flag to IsTrue and NumBool.
*Added choice flag for decoding to a string or table.
*Added specialized string splitter.

Version 1.02 - API bump
Version 1.01 - API bump
Optional Files (1)
File Name
Version
Size
Author
Date
Type
1.06
4kB
09/19/19 01:54 PM
Addon


Archived Files (20)
File Name
Version
Size
Uploader
Date
1.19
6kB
Rhyono
07/21/19 10:31 PM
1.18
6kB
Rhyono
07/02/19 09:31 AM
1.17
6kB
Rhyono
04/15/19 07:44 PM
1.16
6kB
Rhyono
03/31/19 01:32 PM
1.15
6kB
Rhyono
03/25/19 12:35 AM
1.14
6kB
Rhyono
02/12/19 11:41 AM
1.13
6kB
Rhyono
02/11/19 09:35 PM
1.12
5kB
Rhyono
02/09/19 10:14 PM
1.11
4kB
Rhyono
02/09/19 11:16 AM
1.10
4kB
Rhyono
02/08/19 08:15 PM
1.09
4kB
Rhyono
01/26/19 04:50 PM
1.08
4kB
Rhyono
09/20/18 06:55 PM
1.07
4kB
Rhyono
07/09/18 07:50 PM
1.06
4kB
Rhyono
04/16/18 06:43 PM
1.05
4kB
Rhyono
01/08/18 03:43 PM
1.04
4kB
Rhyono
09/29/17 07:05 PM
1.03
4kB
Rhyono
09/03/17 10:19 PM
1.02
4kB
Rhyono
07/15/17 06:05 PM
1.01
4kB
Rhyono
05/22/17 01:40 PM
1.0
4kB
Rhyono
03/20/17 12:15 AM


Post A Reply Comment Options
Unread 06/06/19, 05:56 PM  
Shadowen
 
Shadowen's Avatar

Forum posts: 0
File comments: 2
Uploads: 0
Add-On sorting improperly...

Can the highlighted statement be added in future releases so it gets sorted properly in ESO Add-On dialog window?

In the file LibBinaryEncode.txt:
Code:
;All of the good addons have comments here.

## Title: LibBinaryEncode
## APIVersion: 100026 100027
## Author: |c7f0000Rhyono|r
## Description: Allows encoding binary to compress it.
## Version: 1.17
## AddOnVersion: 17
## IsLibrary: true

LibBinaryEncode.lua
Last edited by Shadowen : 06/06/19 at 06:18 PM.
Report comment to moderator  
Reply With Quote
Unread 04/14/19, 11:05 PM  
jellyalex978
 
jellyalex978's Avatar
AddOn Author - Click to view AddOns

Forum posts: 6
File comments: 49
Uploads: 4
thanks to reduce SavedVariables file !

SavedVariables/CraftStoreFixedAndImproved.lua
2.96mb > 931kb

wow
it's great job

thank you !!
Report comment to moderator  
Reply With Quote
Unread 03/21/17, 09:17 AM  
Rhyono
AddOn Author - Click to view AddOns

Forum posts: 540
File comments: 1004
Uploads: 19
That looks like a byte per boolean, right? This is designed for purely boolean data and as such compresses it to a bit per boolean. I don't believe MessagePack could fit everything into a guild note (254 character).
Report comment to moderator  
Reply With Quote
Unread 03/21/17, 12:49 AM  
Architecture
 
Architecture's Avatar
AddOn Author - Click to view AddOns

Forum posts: 7
File comments: 73
Uploads: 8
What is the advantage of this over using a popular implementation such as MessagePack? http://msgpack.org/index.html http://fperrad.github.io/lua-MessagePack/ -- in theory this should be able to just run since it is purely Lua (or Lua-like) implementation without any extra dependencies. The downside is we can't really benefit from choosing our own JIT such as LuaJIT.

Cool idea -- good work!
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: