In addition to the import_stack and export_stack features, I would like to have an option to use similiar features with the uncompressed blueprint string. While set/get_blueprint_entities/tiles/entity_tags are great, it would be nice to have one combined access to all information.
I tried to inflate a string in lua, but I only found ways, that require specific libraries, which I propably cant or shouldnt include in a mod.
Alternatively adding game.inflate and game.deflate to inflate/deflate strings would solve my problem as well.
I am trying to change the colour of a coloured blueprint and if i could get access to the uncompressed blueprint string, it would be as easy as replacing the name of the blueprint in the uncompressed string. (at the end in item: …).
uncompressed blueprint string
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: uncompressed blueprint string
+1 for zip/deflate support
Would be handy to generate custom "exchange strings" too (for modded stuff other than blueprints).
Would be handy to generate custom "exchange strings" too (for modded stuff other than blueprints).
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: uncompressed blueprint string
As a workaround, you can include the zip library yourself. https://github.com/DaveMcW/blueprint-st ... rintstring
Re: uncompressed blueprint string
+1. Having inflate / deflate and base64 encode/decode available to be used anywhere, not just for blueprints, would be amazing.
Don't forget, you're here forever.
Re: uncompressed blueprint string
Isn't base64 en- and decode already available in the core lualib util file?Raiguard wrote: Wed Feb 05, 2020 3:33 pm +1. Having inflate / deflate and base64 encode/decode available to be used anywhere, not just for blueprints, would be amazing.
Re: uncompressed blueprint string
Well yes, but not zlib inflate and deflate.
Don't forget, you're here forever.
Re: uncompressed blueprint string
This was added, so this topic can be moved now.
Don't forget, you're here forever.
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: uncompressed blueprint string
Had to search a bit until i found what you mean so i'll post it here for future readers:
Code: Select all
LuaGameScript.encode_string(string) → string Deflates and base64 encodes the given string.
LuaGameScript.decode_string(string) → string Base64 decodes and inflates the given string.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: uncompressed blueprint string
Yes, the Factorio blueprint strings have a single digit at the beginning denoting a version. Remove the first character of a compressed blueprint string and it'll work with the new functions.
Don't forget, you're here forever.