Module snippet

Random junk.

Module Status: Work in progress forever.

Usage:

    local snippet = require('__eradicators-library__/erlib/factorio/snippet')()
    

Todo

todo1 Nothing.

Section

compact_repr_arr_of_string(arr, target_length) Compresses an array of random strings to fit into as fewest lines of as code possible.


Todo

todo1
Nothing.
  • todo1

Section

compact_repr_arr_of_string(arr, target_length)
Compresses an array of random strings to fit into as fewest lines of as code possible. Does not respect element order obviouly. Used to better encode long lists of stuff.

Parameters:

Returns:

    string

Usage:

    local r={}; for i=1,10 do r[#r+1] = ('0'):rep(i) end
    print(snippet.compact_repr_arr_of_string(r,22))
    
    > {
    "0000000000","000000",
    "000000000","0000000",
    "00000000","00000",
    "0000","000","00","0",
    }
    
generated by LDoc 1.4.6 Last updated 2021-09-10 19:51:19