Big Data String 2

by plexpt

Store up to 2 × 10²⁸ chars long strings during data stage and read them during control stage. prototypes => runtime

8 days ago
2.0
17
Owner:
plexpt
Source:
N/A
Homepage:
N/A
License:
The Unlicense (Public Domain)
Created:
8 days ago
Latest Version:
2.0.0 (8 days ago)
Factorio version:
2.0
Downloaded by:
17 users

Big Data String Library2


We introduce a simple helper mod to transfer data as string through data lifecycle from data stage into control stage.
This mod generates an item prototype definition with the data string chunked into localised_description.
The maximal possible string length is 10 * 20 ^ (20 + 1) ≈ 2 × 10²⁸.

Usage example


in data.lua:

local bigpack = require("__big-data-string2__.pack")
local encode = tostring -- for example or serpent.block
local function set_my_data(name, data)
    return bigpack(name, encode(data))
end
-- use it like this
data:extend{set_my_data(name, data)}

in control.lua:

local bigunpack = require("__big-data-string2__.unpack")
local decode = tonumber -- for example
local function get_my_data(name)
    return decode(bigunpack(name))
end
-- use it like this
if get_my_data(name) == 42 then fun(...) end

Compatibility


Very Good

Acknowledgment

This project utilizes the mod «Big Data String Library», which was developed by dodo.the.last. We would like to extend our sincere gratitude to dodo.the.last for their hard work and valuable contribution to the open-source community.

The «Big Data String Library» is published under The Unlicense, which allows for free and unrestricted use of the software. Below is the license text:

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors.

Due to the terms of The Unlicense, you are free to use this library without any restrictions.