Download
(7 Kb)
Download
Updated: 03/15/22 04:39 PM
Pictures
File Info
Compatibility:
Ascending Tide (7.3.5)
Deadlands (7.2.5)
Waking Flame (7.1.5)
Blackwood (7.0.5)
Flames of Ambition (6.3.5)
Markarth (6.2.5)
Stonethorn (6.1.5)
Greymoor (6.0.5)
Updated:03/15/22 04:39 PM
Created:03/19/17 11:40 PM
Monthly downloads:11,027
Total downloads:1,562,227
Favorites:533
MD5:
LibBinaryEncode  Popular! (More than 5000 hits)
Version: 1.34
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. Even if you are using it as internal storage, it is preferred (and often necessary) that you provide a schema for multi-dimensional mapping. As such, you should generally use this over the Encode/Decode directly for anything but the most basic encodings.

Important note: always define prefixes as early as possible in your addon, preferably in AddOnLoaded. 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


If your data source is guaranteed to be purely your data, but possibly an earlier version, this will return purely the data in a table (or a new copy of the schema if the data was not found)

lua Code:
  1. LBE:ParseTrusted(text_string, addonName, purpose)

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>=23
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.34 - API Bump
Version 1.33 - API Bump
Version 1.32 - API Bump
Version 1.31 - API Bump
Version 1.30 - API Bump
Version 1.29 - API Bump
Version 1.28 - API Bump
Version 1.27 - API Bump

Version 1.26
*Fixed MergeTables issue (thanatos6110)
*Exposed FlattenTable

Version 1.25 - Optimized MergeTables

Version 1.24
*Non-boolean values will now default to false instead of true
*Added MergeTables

Version 1.23 - Added ParseTrusted

Version 1.22
*Fixed an issue
*Added partial logging (disabled and only should be used for debugging)

Version 1.21 - Replaced all 2 dimension support with Nth dimension

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.16
4kB
03/15/22 04:47 PM
Addon


Archived Files (31)
File Name
Version
Size
Uploader
Date
1.33
7kB
Rhyono
09/25/21 05:29 PM
1.32
7kB
Rhyono
05/15/21 05:55 PM
1.31
7kB
Rhyono
02/28/21 12:10 PM
1.30
7kB
Rhyono
11/02/20 12:05 AM
1.29
7kB
Rhyono
08/08/20 12:10 PM
1.28
7kB
Rhyono
04/25/20 05:13 PM
1.27
7kB
Rhyono
01/26/20 04:02 PM
1.26
7kB
Rhyono
12/02/19 11:56 PM
1.23
7kB
Rhyono
11/21/19 11:53 PM
1.22
7kB
Rhyono
11/09/19 02:31 PM
1.20
6kB
Rhyono
09/19/19 01:54 PM
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 03/21/17, 12:49 AM  
Architecture
 
Architecture's Avatar
AddOn Author - Click to view AddOns

Forum posts: 7
File comments: 79
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: