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:8,090
Total downloads:1,550,845
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 11/10/19, 02:56 AM  
Grimm13

Forum posts: 0
File comments: 33
Uploads: 0
LBE 1.22 & CS Dragonhold 2.29 both working as intended. Thank you for the fix.
Report comment to moderator  
Reply With Quote
Unread 11/09/19, 08:59 AM  
BlazeOfGlory

Forum posts: 0
File comments: 21
Uploads: 0
Exclamation Still Broken

Had this and CraftStore working and then today, when I logged onto ESO, it said I needed a new version but there hadn't been any new version released. I have version 1.21

I get this error...

user:/AddOns/LibBinaryEncode/LibBinaryEncode.lua:208: in function 'FlattenTableND'
|caaaaaa<Locals> tbl = [table:4], schemaTbl = [table:5], NextDimension = user:/AddOns/LibBinaryEncode/LibBinaryEncode.lua:184 </Locals>|r
(tail call): ?
user:/AddOns/LibBinaryEncode/LibBinaryEncode.lua:312: in function 'LibBinaryEncode:Encode'
|caaaaaa<Locals> self = [table:8]{author = "Rhyono", version = 21, name = "LibBinaryEncode"}, binStr = [table:4], addonName = "CraftStoreFixedAndImproved", purpose = "Crafting", base = 64, prefix = "CSCS29", schemaType = 2, baseLen = 6, temp = [table:9]{} </Locals>|r
user:/AddOns/CraftStoreFixedAndImproved/CraftStore.lua:726: in function 'CS.UpdatePlayer'
|caaaaaa<Locals> deactivation = T, GetBonus = user:/AddOns/CraftStoreFixedAndImproved/CraftStore.lua:664, ride = [table:10]{1 = 60}, rideTime = 0, rideComplete = T, level = 0, levelcp = 695, skill_points = "?/?", _ = 1, char = "Zarre B'azun" </Locals>|r
user:/AddOns/CraftStoreFixedAndImproved/CraftStore_Events.lua:210: in function 'CS.OnPlayerDeactivated'
|caaaaaa<Locals> eventCode = 589825 </Locals>|r

Then this error comes up when I dismiss the first...

bad argument #1 to 'pairs' (table/struct expected, got boolean)
stack traceback:
[C]: in function 'pairs'
user:/AddOns/CraftStoreFixedAndImproved/CraftStore.lua:656: in function 'CS.UpdateAllStudies'
|caaaaaa<Locals> craft = 1, craftData = F </Locals>|r
user:/AddOns/CraftStoreFixedAndImproved/CraftStore_Events.lua:190: in function 'CS.OnPlayerActivated'
|caaaaaa<Locals> eventCode = 589824, initial = F </Locals>|r
Last edited by BlazeOfGlory : 11/09/19 at 09:00 AM.
Report comment to moderator  
Reply With Quote
Unread 11/09/19, 07:56 AM  
Darkwave76

Forum posts: 0
File comments: 20
Uploads: 0
Same issue..
Tried to delete also saved var of crafstore and reinstall it and those library, but still get this error.
Report comment to moderator  
Reply With Quote
Unread 11/09/19, 06:10 AM  
kebabman

Forum posts: 2
File comments: 17
Uploads: 0
Getting the following error since updating craftstore this morning:



bad argument #1 to 'pairs' (table/struct expected, got boolean)
stack traceback:a
[C]: in function 'pairs'
user:/AddOns/LibBinaryEncode/LibBinaryEncode.lua:187: in function 'NextDimension'
<Locals> tbl = F, schemaTbl = [table:1]{}, outTbl = [table:2]{}, tblKeys = [table:3]{} </Locals>
user:/AddOns/LibBinaryEncode/LibBinaryEncode.lua:197: in function 'NextDimension'
<Locals> tbl = [table:4]{1 = F}, schemaTbl = [table:5]{}, outTbl = [table:6]{}, tblKeys = [table:7]{1 = 1}, _ = 1, key = 1 </Locals>
user:/AddOns/LibBinaryEncode/LibBinaryEncode.lua:208: in function 'FlattenTableND'
<Locals> tbl = [table:4], schemaTbl = [table:5], NextDimension = user:/AddOns/LibBinaryEncode/LibBinaryEncode.lua:184 </Locals>
(tail call): ?
user:/AddOns/LibBinaryEncode/LibBinaryEncode.lua:312: in function 'LibBinaryEncode:Encode'
<Locals> self = [table:8]{name = "LibBinaryEncode", version = 21, author = "Rhyono"}, binStr = [table:4], addonName = "CraftStoreFixedAndImproved", purpose = "Crafting", base = 64, prefix = "CSCS29", schemaType = 2, baseLen = 6, temp = [table:9]{} </Locals>
user:/AddOns/CraftStoreFixedAndImproved/CraftStore.lua:726: in function 'CS.UpdatePlayer'
<Locals> deactivation = T, GetBonus = user:/AddOns/CraftStoreFixedAndImproved/CraftStore.lua:664, ride = [table:10]{1 = 60}, rideTime = 0, rideComplete = T, level = 0, levelcp = 1341, skill_points = "?/?", _ = 5, char = "Laiel Uvurayn" </Locals>
user:/AddOns/CraftStoreFixedAndImproved/CraftStore_Events.lua:210: in function 'CS.OnPlayerDeactivated'
<Locals> eventCode = 589825 </Locals>
Report comment to moderator  
Reply With Quote
Unread 11/09/19, 02:37 AM  
raspberry

Forum posts: 2
File comments: 14
Uploads: 0
same error here.
occours when using my banker or look into my inventory.
/reloadui helps shortly to get out of the frozen char

deleting the craftstore saved vars, does not make a difference

edit:
just now took the old version (20) out of my backup and replaced the current version against the old one.==>
no success, same error

edit 2:
now i am using an old version of craftstore.
works a bit better .. cf version 2.22
but i get other errors. at least it does his job an u can use your inventory
Last edited by raspberry : 11/09/19 at 02:59 AM.
Report comment to moderator  
Reply With Quote
Unread 11/07/19, 04:12 AM  
wyndstryke
AddOn Author - Click to view AddOns

Forum posts: 2
File comments: 36
Uploads: 1
Originally Posted by Grimm13
Originally Posted by Rhyono
That should only happen if your CS saved vars were old. If the next CS version doesn't fix it, I'll look into it.
I had deleted the saved variables when it was recommended to do it and it was working until the forced delete. Now I am getting these same LibBinaryEncode errors.
Same here

Was getting a craftstore error, so I uninstalled craft store, deleted the saved variables, then reinstalled craftstore. Still getting a craftstore error, but now I'm also getting a LibBinaryEncode error lol. Two for the price of one.
Report comment to moderator  
Reply With Quote
Unread 11/07/19, 03:49 AM  
Grimm13

Forum posts: 0
File comments: 33
Uploads: 0
Originally Posted by Rhyono
That should only happen if your CS saved vars were old. If the next CS version doesn't fix it, I'll look into it.
I had deleted the saved variables when it was recommended to do it and it was working until the forced delete. Now I am getting these same LibBinaryEncode errors.
Report comment to moderator  
Reply With Quote
Unread 11/06/19, 12:36 PM  
Coolio_Wolfus

Forum posts: 0
File comments: 28
Uploads: 0
Exclamation Latest ESO patch/hotfix killed it.

It's definitely a LibBinaryEncode issue.

Getting reported by plenty of CraftStore users, as both it and this fall over with an lua fail.
Report comment to moderator  
Reply With Quote
Unread 11/06/19, 10:21 AM  
Rhyono
AddOn Author - Click to view AddOns

Forum posts: 659
File comments: 1357
Uploads: 19
That should only happen if your CS saved vars were old. If the next CS version doesn't fix it, I'll look into it.
Report comment to moderator  
Reply With Quote
Unread 11/06/19, 07:26 AM  
Doombug

Forum posts: 2
File comments: 10
Uploads: 0
same error as everyone else
Report comment to moderator  
Reply With Quote
Unread 11/06/19, 06:24 AM  
Snakefish

Forum posts: 0
File comments: 109
Uploads: 0
Exclamation Error Msg.

bad argument #1 to 'pairs' (table/struct expected, got boolean)
stack traceback:
[C]: in function 'pairs'
user:/AddOns/LibBinaryEncode/LibBinaryEncode.lua:187: in function 'NextDimension'
<Locals> tbl = F, schemaTbl = [table:1]{}, outTbl = [table:2]{}, tblKeys = [table:3]{} </Locals>
user:/AddOns/LibBinaryEncode/LibBinaryEncode.lua:197: in function 'NextDimension'
<Locals> tbl = [table:4]{1 = F}, schemaTbl = [table:5]{}, outTbl = [table:6]{}, tblKeys = [table:7]{1 = 1}, _ = 1, key = 1 </Locals>
user:/AddOns/LibBinaryEncode/LibBinaryEncode.lua:208: in function 'FlattenTableND'
<Locals> tbl = [table:4], schemaTbl = [table:5], NextDimension = user:/AddOns/LibBinaryEncode/LibBinaryEncode.lua:184 </Locals>
(tail call): ?
user:/AddOns/LibBinaryEncode/LibBinaryEncode.lua:312: in function 'LibBinaryEncode:Encode'
<Locals> self = [table:8]{name = "LibBinaryEncode", version = 21, author = "Rhyono"}, binStr = [table:4], addonName = "CraftStoreFixedAndImproved", purpose = "Crafting", base = 64, prefix = "CSCS29", schemaType = 2, baseLen = 6, temp = [table:9]{} </Locals>
user:/AddOns/CraftStoreFixedAndImproved/CraftStore.lua:721: in function 'CS.UpdatePlayer'
<Locals> deactivation = T, GetBonus = user:/AddOns/CraftStoreFixedAndImproved/CraftStore.lua:659, ride = [table:10]{1 = 60}, rideTime = 0, rideComplete = T, level = 0, levelcp = 1237, skill_points = "100/397", _ = 1, char = "Antonia minor Augusta" </Locals>
user:/AddOns/CraftStoreFixedAndImproved/CraftStore_Events.lua:210: in function 'CS.OnPlayerDeactivated'
<Locals> eventCode = 589825 </Locals>
Report comment to moderator  
Reply With Quote
Unread 11/05/19, 09:58 PM  
Akopian Atrebates

Forum posts: 9
File comments: 230
Uploads: 0
New Problem

With the updates of this and Craftstore, I am getting the following error:

bad argument #1 to 'pairs' (table/struct expected, got boolean)
stack traceback:
[C]: in function 'pairs'
user:/AddOns/LibBinaryEncode/LibBinaryEncode.lua:187: in function 'NextDimension'
user:/AddOns/LibBinaryEncode/LibBinaryEncode.lua:197: in function 'NextDimension'
user:/AddOns/LibBinaryEncode/LibBinaryEncode.lua:208: in function 'FlattenTableND'
(tail call): ?
user:/AddOns/LibBinaryEncode/LibBinaryEncode.lua:312: in function 'LibBinaryEncode:Encode'
user:/AddOns/CraftStoreFixedAndImproved/CraftStore.lua:721: in function 'CS.UpdatePlayer'
user:/AddOns/CraftStoreFixedAndImproved/CraftStore_Events.lua:210: in function 'CS.OnPlayerDeactivated'

Problem disappeared after deleting saved variables file for Craftstore as explained in the comments to that addon.

Thanks for your work!
Last edited by Akopian Atrebates : 11/05/19 at 10:06 PM.
Report comment to moderator  
Reply With Quote
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: 8
File comments: 60
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: 659
File comments: 1357
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
Post A Reply



Category Jump: