Big Data String Library


Store up to 2 × 10²⁸ chars long strings during data stage and read them during control stage

Internal
2 years ago
1.1
40.6K
Owner:
dodo.the.last
Source:
N/A
Homepage:
N/A
License:
The Unlicense (Public Domain)
Created:
3 years ago
Latest Version:
1.0.1 (2 years ago)
Factorio version:
1.1
Downloaded by:
40.6K users

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-string__.pack")
local encode = tostring -- for example
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-string__.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


We haven't discover any incompatibilities with other mods to date. Please report on the mod page discussion if any incompatibilities are discovered.
Works with multiplayer.

Documentation


License


The mod ‹Big Data String Libary› was made by dodo.the.last and published under The Unlicense.

Notes


The information on this mod page represents the state of the current release and might be updated without prior notification or public announcement. Please refer to the «Documentation» section of this page for details.