Signal Strings Library

A library for converting between lua strings and virtual signal strings
1 year, 1 month ago
0.14 - 0.16
Owner: justarandomgeek
Source: justarandomgeek/factorio-signalstrings
Homepage: N/A
License: MIT
Created: 1 year, 11 months ago
Latest Version: 0.16.0 (1 year, 1 month ago)
Factorio version: 0.14 - 0.16
Downloaded: 2544 times


This library provides common functions for handling strings on circuit networks. Strings are expressed as a bitmask of where each letter appears, LSB on the left.
"FOOBAR" = {signal-F=1,signal-O=6,signal-B=8,signal-A=16,signal-R=32}

Strings may be converted to signals using'signalstrings','string_to_signals',"FOOBAR"), and optionally with extra data (in the form of Constant Combinator params to be prefixed) using'signalstrings','string_to_signals',"FOOBAR", extrasignals). Strings are automatically converted to all-caps to ease conversion, and non-representable characters are discarded (leaving empty space).

Signals may be converted back to a string using'signalstrings','signals_to_string',signallist). Non-string data is discarded, and overlapped characters may produce malformed strings.

Mods that add signals may register them for string conversions by calling'signalstrings','register_signal','signal-name','X') in their on_load and on_init events.